Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [nodes]

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

0
votes
0answers
21 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
12 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
26 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
38 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
27 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 ...
-2
votes
0answers
21 views

How to move multiple nodes to another user [on hold]

Answering my own question. For example with code. $node = '30837,30845,30850'; $nodes = explode(",", $node); foreach($nodes as $nid){ $node = node_load($nid); // If you want to make sure ...
0
votes
1answer
17 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 "...
-1
votes
0answers
9 views

How to attach autocomplete to fieldset field. i have attached code but its not working. Drupal7

function ajaxengine_form_cruiseline_reservation_node_form_alter(&$form, $form_state, $form_id) { $form['#after_build'][] = 'ajaxengine_after_build'; } function ajaxengine_after_build($...
0
votes
0answers
17 views

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

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
38 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 ...
-3
votes
2answers
32 views

How do I pass three arguments to a validation handler? [closed]

Drupal 8 1)I want to add third parameter $form also in (&$form_state, $node){}.. But it throws error function prevent_deletion_form_alter(&$form, FormStateInterface $form_state, $form_id) ...
0
votes
2answers
23 views

Search Nodes by reference field target ID

I have a Node by the Project bundle name. Each Project has a reference field to another entity by the name of Contact, that this contact entity has the Client bundle. I can get the Client target ID ...
-1
votes
0answers
25 views

Sell Node Access

I currently use Drupal 8 with Commerce 2 for my site and I would like to implement a way to sell node access to users. Looking around I have found a guide for Commerce 1 to sell nodes, though ...
0
votes
0answers
25 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
34 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
41 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
47 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 ...
2
votes
1answer
72 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
27 views

Translated meta tag values not removed after deleting page translations

I am using Drupal 7 and the Metatag module version 7.x-1.25 on a multi-lingual site. I have added a different meta tag for Canada translations, and I want to remove it. As I have added only the meta ...
-1
votes
0answers
58 views

Performance issue while loop through all groups and create node for each

I wrote the below code in the .module file of my custom module which is scheduled to run once a day using cron. I have tested the code with only two groups available, and noticed a performance issue ...
0
votes
1answer
88 views

Programmatically and automatically delete every node after 2 years from its creation time [closed]

My question has a half answer here but not completed for my case. This is the piece of code I am talking about: <?php function mymodule_cron() { $storage_handler = \Drupal::entityTypeManager() ...
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'...
1
vote
0answers
17 views

IEF reference show parent field as title using Auto Entity Label

I am new to Drupal 8 want to add a field value to IEF reference title. for now, I am using Auto Entity Label version 2.x-dev to automatically generate a title for my Entities but when it comes to IEF ...
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
37 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
21 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
43 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
14 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
31 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
33 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
28 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
15 views

D8 VBO - 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
64 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
16 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
38 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
62 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
19 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
33 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 ...
1
vote
1answer
32 views

Custom edit Panel/Tab for content type

In Drupal 8 I have a custom content type, and I want to add a group of fields to it that are related to tracking. Since these fields don't have to do with the content displayed, I wanted to separate ...
0
votes
1answer
50 views

Render taxonomy type custom fields individually

I'm kind of a twig newbie so I'm hoping that someone can point me in the right direction. I've added a custom field field_url to a taxonomy type called field_type_poi. How would you render that ...
0
votes
0answers
21 views

Image alt tag not saving on save/edit

I have a content type for gallery photos which has a Image data type. When I create the content type Drupal ignores the alternate text I enter for any uploaded image. When I edit the content type ...
0
votes
0answers
22 views

Revisions counter in node overview

I would like to see how many revisions a node has in the node overview page (/admin/content). The ones that are listed in e.g. .../node/ID/revisions It can't find anything like delta revisions or has ...
0
votes
0answers
13 views

List of food items on a node that can be rated and shown in order of their rating

I'm looking to have a list of fields on a node, each field is a food item and this list of food items are sorted by their rating/vote from the public. How is this possible? I'm thinking paragraphs ...
0
votes
2answers
117 views

How to render author custom fields info on comment and node twig template?

I am trying to render the author Full Name and other authors customs fields information in comment.html.twig and node.html.twig. But not any of the fields that I made for users such as "First Name", "...
1
vote
2answers
65 views

Get node's view mode within template_preprocess_page

We have to get the current node's view_mode from within the mymodule_preprocess_page(&$variables) hook. When we tried the following we could not get the view_mode after performing some validation ...
0
votes
0answers
115 views

Programmatically set a $form_state value for user reference

I'm trying to programmatically create nodes through form submit in Drupal 8 (because I need to validate the submitted values) in this way. try { $node = \Drupal::entityTypeManager() ->...