Questions tagged [nodes]

The most basic form of content on a Drupal site is a node.

Filter by
Sorted by
Tagged with
0
votes
1answer
32 views

Filter a view with contextual authored date

I have a Drupal 8 view where I want to sort nodes by authored year using contextual filters. So www.mysite.com/2017 will list all nodes from 2017. I set up the filter using 'Content: Created Year' ...
0
votes
1answer
29 views

Link module output with content type

I am confused on how to output links from a content type into a list in HTML. Currently I have the following code. <div class="lenders-block-content clearfix"> <ul> <?...
0
votes
1answer
20 views

How to join the `field_data_field_*` tables with `node` table using SQL?

I apologize if I ask for something obvious, but I am asking because I could not find a simple answer anywhere. I know how to work with these tables in the PHP Drupal code, which built-in functions to ...
0
votes
0answers
33 views

Create custom webform when creating node?

I’m trying to find out if it’s possible to create webforms when creating nodes or paragraphs. I mean instead of choosing a predefined webform, then build it right inside the field. I figured that ...
4
votes
1answer
202 views

How to disable creation of node revisions on programmatic node update?

I added a field of type computed field to existing nodes. It's required to re-save the nodes to set/update computed field values. As I do not want to update the changed timestamp I decided to not use ...
0
votes
0answers
26 views

Node::access with anonymous user

I want to add a CSS class in hook_preprocess_html(), which indicates that logged-in users have access to the content and that anonymous users don't have access to it. First I get the node with $node ...
0
votes
1answer
27 views

How to use hook_views to add calculation to a field?

In a custom module (assoc), I have a custom Content Entity (Person) with these fields: $fields['lastname'] = BaseFieldDefinition::create('string') $fields['firstname'] = BaseFieldDefinition::create('...
0
votes
3answers
61 views

Menu tree from taxonomy terms and nodes which belong to them

i need to create a collapsible menu tree from taxonomy terms and nodes which belong to them (not nested terms, but content pages) i'm totally stuck about it i've found solutions for nested taxonomy ...
0
votes
0answers
44 views

Check if a user has already created a node and redirect the user when the node exists

I am trying to redirect users to a page when they have already created a node in mytheme.theme, in order to prevent a user to create a node twice. function mytheme_node_prepare($node) { if ($node-&...
0
votes
0answers
17 views

Override imported data on node creation

I would like to transform some data I am getting from an RSS feed. I get a set of items and create nodes using the data I get, so far so good. However, some of the data fields contain relative URLs, ...
0
votes
1answer
13 views

Node Export being downloaded as a .sh file and unable to be imported

In my Drupal 7 project, I have some content of a custom content-type (page) that I need to import into another environment. When I go to this content instance, I select on Node Export, which then ...
-2
votes
1answer
33 views

Creating a displayable 'index' of content nodes within a path

Ok, it's been over a decade since I've worked with Drupal (primary use was for a personal blogging platform, with a bit of extra extensibility and a well developed plugin ecosystem). Sadly, most of my ...
0
votes
0answers
42 views

Drupal 8 uploaded should be stored in certain s3 bucket

Currently, I'm facing an issue while uploading a file. I'm fetching the file tid with hook_entity_presave: $file_tid = $entity->get('field_photos_photos') ->getValue()[0]['target_id']; if(!...
0
votes
1answer
27 views

Unable to access translated node content

After performing a Drupal core update on my site today I've found that I can no longer access translated content. When I try to view or edit the translation, I only see the default language content. ...
0
votes
1answer
20 views

How to validate field in inline entity form referenced field

I have created field "Referenced" which is entity reference field of other content type. Also this field have inline entity form functionality means its giving two button "add new node" and "and ...
0
votes
2answers
301 views

AJAX callback inside hook_form_alter()

I don't know how to implement AJAX callback in hook_form_alter(). The field is plain text by default and it is populated by NID (number) of the client company. The module name is "my_car". I didn't ...
0
votes
1answer
15 views

Excluding inline images in views

I have a node type with an image field and insert button to get the image into the text field. Then there is a view that is getting the content of the text field and shortening it to 150 characters. ...
0
votes
0answers
47 views

Render content type display mode in custom module [duplicate]

I'm facing the issue with rendering content type in specified display mode (teaser) in my custom module. I have a module which stores NIDs in session, and when user enters specific page, I want to ...
1
vote
0answers
22 views

behavior of path on unpublished/draft nodes

We have a Drupal 8 site with a press releases page. Currently the press releases page is provided by a view with a page display. The path in the page display is set to /press-releases. I've been ...
0
votes
1answer
36 views

How to print the URL of a title field?

I'm trying to print out the url path from the title in my twig template however I haven't been successful so far. Printing out the title containing the link works fine using: {{content.title}} ...
1
vote
1answer
56 views

How to use hook_prepare to modify a field of a node before it is edited

I want to modify the contents of a field of an Article node just before it comes up for editing. I have read the documentation at http://api.hostdog.gr/api/drupal-8/drupal%21core%21modules%21node%...
0
votes
1answer
141 views

Custom Page routing

I created a custom page type called 'Angular page' and a custom twig template for it which loads my angular scripts and prints the <app-root> tag. I set the page URL to /angularpage and the ...
0
votes
1answer
52 views

REST Export Views and images alternative text

I have a simple REST export View. The View format is set to "Show: Entity". The content type I am exporting contains a standard image field. My image field settings is set to "Enable Alt field" and "...
0
votes
0answers
26 views

How to get referenced entity fields from another content type in single node template [duplicate]

I have a content type called "Resources", this is referenced from another content type called "Projects". I can get simple text fields in my single node--project.html template for example - {{...
0
votes
2answers
265 views

How do I pass a value to a content type field with a custom submit please

and thank you for your patience in helping me learn I have created a content type called response (Through Drupal, not in a custom module) In the content type I have a field called ...
0
votes
0answers
35 views

How to rename a content type programmatically

There are many answers and tutorials addressing the problem of changing the machine name of a content type, or migrating content types. However, I would like to rename a content type, without changing ...
1
vote
1answer
55 views

How to reference taxonomy used by other content type?

I have two content types: Content A and Content B Fields in Content A: Title, Location, Body Fields in Content B: Title, Type, Location, Body Location is a vocabulary (Au, Uk, Us, Ca, etc) Type is ...
0
votes
1answer
126 views

How can I get all fields and values of a node at once?

I know how to get a particular field (title field) of a node by following code: $publications = \Drupal::entityManager()->getStorage('node')->load($node_id); $title = $publications->getTitle(...
0
votes
1answer
379 views

Get node based target id from entity reference

We have an Article content type which has an Entity Reference field called field_document that is linked to the Media bundle type of Document. In mymodule we need to write a hook that will take the ...
3
votes
1answer
151 views

Memory leak when looping through nodes

I've got code that loops through nodes in order to generate processed output. I've previously done an entity query that provided an array of node IDs. My main loop code looks like this: foreach ($...
0
votes
0answers
10 views

Error: Event registration is not enabled

So I have a basic node with a button allowing users to register, it is not a custom module, but when I click the 'register to the event' button in debug mode it shows that message on the log and doesn'...
0
votes
0answers
23 views

Link entire teaser views row to content with core or contributed module?

When creating views I prefer use views modes rather than fields. I have been reading up on accessibility stuff and one topic that comes up is that adjacent fields, linking to the same url can be a ...
0
votes
0answers
16 views

Need to edit links in hundreds of nodes - can it be done via a module?

I have a number of nodes of a content type in which the body contains links using bit.ly. These links no longer resolve due to domain name changes to the original link that was 'bitlyed'. I've been ...
0
votes
1answer
44 views

session_unset logs out user when viewing the page

We have an application that we developed in Drupal 7 and I am tasked with migrating this form to Drupal 8. I have a question about the session behavior which seems to have changed from Drupal 7 to 8. ...
0
votes
1answer
223 views

Display multi-value entity reference field in node edit form as draggable?

Is there a way to display a multi-value entity reference field as a draggable widget in a node edit form? I'm looking for the exact same behavior that a multi-value image field has by default. I would ...
2
votes
0answers
47 views

EntityQuery with node_access module compatibly

I have installed node_access for maintaining access per node. I need to write a sql query using entityQuery service and display only those nodes which respect node_access configuration per node. I am ...
0
votes
0answers
18 views

Is it possible to store a query calculation result in a search index?

I am counting nodes of a specific type associated with terms with this query: $connection = \Drupal::database(); $query = $connection->select('taxonomy_index', 'ti'); $query->join('...
0
votes
1answer
34 views

How Can I do a content type with a 1:n field inside?

I'm a bit lost about how Drupal manage content. For example, I want to create a new content type called Game. When I create a "Game" I want to introduce "Platform" and "Release date". For example: ...
0
votes
1answer
44 views

I can see the changes I made (as an administrator) but as an anonymous user, I can't

Have you had any problems like this before? I appreciate your help. When I'm an admin and update a node (custom module), I can see the changes I made (as an administrator). However, when I'm an ...
0
votes
2answers
79 views

Display related media entities

We are using the Basic Page content type and it has an Entity Reference field (field_document) that points to the Document (Media bundle), which has a field_document_tag (taxonomy term field). The ...
-1
votes
1answer
43 views

module_invoke_all() pass arguments by reference?

when I implement the HOOK_node_presave , I can access to the $node and alter it ex: function drupal7_test_node_presave($node){ $node->title = 'Abricoooooooooooooooooo'; } the strange thing is ...
0
votes
1answer
28 views

Pass selected values to node add form

I have a view of nodes. I'd like to be able to select rows (thinking VBO is the best) and pass those selected nodes to a form (specifically /node/add/payments) to pre-populate entity references. ...
0
votes
1answer
154 views

Get the node ID value after submitting an attached Webform to that node

I have a Webform attached as a field to a specific content type. After the node is loaded and the Webform is submitted, I am using the below custom webform handler to get the $webform_submission ...
0
votes
1answer
18 views

How do I create a log/statistics of on page events?

I am using drupal 7, I have seen there are already statistic modules but can't find any for my situation On my website I am trying to track certain on page activities which site admins can see in a ...
-2
votes
1answer
16 views

Different formatter's field by file extension

I have Drupal 7 and a file field and users can upload pdf, office documents and image. For pdf i have pdf.js formatter, office doc's have simple link to download and image show by fancybox plugin. I ...
0
votes
1answer
227 views

How to get the referenced node id in a webform?

I have a webform that is connected to a node in drupal 8. When the webform loads from the node link I need to get the source entity id from url. How can I achieve that in my custom module? the url is ...
0
votes
1answer
286 views

Output field with double quotes in twig

We have a field, field_text, that we are displaying on the Basic Page content type. It needs to display with double quotes " using twig template. We tried the following below, but it is displaying ...
0
votes
0answers
4 views

Nodes for sidebar menu

I'm hoping someone can help me figure how I deleted a sidebar menu on one of my pages. Does anyone know how to get it back or recreate a sidebar menu ?
1
vote
1answer
70 views

Remove library from page based on node field value

We have a content type, Basic Page, where we may want to include 3rd party CSS such as Bootstrap. However, this 3rd party CSS may conflict with our custom theme, mytheme. On the Basic Page, we added a ...
0
votes
1answer
45 views

How to use custom code to change the node form layout and group fields while maintaining values?

I am trying to alter the node form layout in a form alter hook. I altered the node form and added a field set in which I grouped couple of existing fields into a fieldset. Then hid the existing ...