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
20 views

Navigation for book collections

I'm working in a projet where I have to show a collection of books. In this website I managed using the books navigation block, for one collection with many books, with css I managed to set a tree ...
0
votes
1answer
373 views

How to append options and classes into a custom attribute in Twig?

In our twig template we have a need to wrap certain fields with a Link field. In the existing twig template there already exist an attributes variable (accessed by adding attributes), but we have a ...
1
vote
1answer
29 views

Add another button removes the default values from my fields on node form

I have a node form on which two fields are displaying. One is a list of radio buttons which is required field. I am getting a value from url using arg(3) and setting the default value of that field $...
0
votes
1answer
738 views

How to access/arrange the {{ content }} field within a Drupal 8 template?

I am relatively new to Drupal and have just successfully (thanks to help from this community) pulled out a field value and used it to display a custom icon on the page. Coming from a HTML/CSS only ...
-1
votes
1answer
28 views

How to migrate one type of contents to other type having same fields? [closed]

I have 2 content types having same fields and I have many contents added by cleint in both the types,now I want to change some of the node's type A other type.. How can i achieve this?
0
votes
0answers
150 views

How to get the group entity for automatic entity label when creating nodes?

When creating a new node, you can assign it a group (group project). I need the group field's value to put into my node title. The problem is, there is no token to use within AEL for the group and ...
-1
votes
1answer
50 views

Prevent delete content before it is removed in external index

This is my use case. We have a Drupal 8 installation that we used as decoupled, so one external API retrieve all content and them indexed. So, this external API update indexed content when Changed ...
0
votes
1answer
34 views

How can I change the value of a field in node / [id] / edit?

I should change the value of a field before it is rendered. I tried with [NAME_MODULE]_node_view but it is not invoked when I edit the node. Thank you so much.
0
votes
1answer
286 views

Show child pages in parent node view details in a book

I'm using the Book module to maintain the parent-child relationship between content. I want to see all child pages expanded when I see a parent node details page. How can I achieve it? I tried with ...
0
votes
0answers
133 views

Display tooltip help text on the node display page

I search all over the internet with no success answer for my requirement... I want to display help text for each field on the node display page (ex: /node/16) and not on the node edit page (ex: /node/...
0
votes
0answers
37 views

reset existing content type settings to default settings

In my Drupal 7 Site, I have a couple of Nodes of the same content type. On some of them, the settings( Menu, Sitemap) have been changed. How can I reset all of them to the default settings for that ...
0
votes
1answer
117 views

How to create custom view/display for few content_types?

EDIT: see two paragraphs below to what I managed to get I can't find a way to use single template for few but not all content_types. Let's say I have content_types A, B, C and D. I want to use ...
0
votes
1answer
270 views

Call to a member function label() on null after saving a node with a taxonomy term

I create nodes, which have a taxonomy field, like this: $node = Node::create([ 'type' => 'article', 'status' => 1, 'title' => 'Some title', ... 'field_taxonomy' => [1, 2, 3], ]);...
0
votes
1answer
122 views

How display node author roles at node.html.twig

My user case is: Extlink module can add exception classes to avoid processing some links. I want some external url links on nodes whom author belongs to a special role (premium) can be mark with a ...
0
votes
0answers
32 views

How to delete file entries on click of Remove button in file upload?

The orphaned entries of a file which is associated to the node should be removed when a file which is attached to a node is removed from it. Like associated entries from file_managed table. How to ...
0
votes
2answers
146 views

How do you set a node reference field's default value when creating a node programatically?

I use this: $values = array( 'type' => 'competition', 'title‎' => 'my title goes here', ); $node = \Drupal::entityTypeManager() ->getStorage('node') ->create($values); This works ...
0
votes
2answers
78 views

Get taxonomy terms added to nodes

I am trying to get all the taxonomy terms added to a node. How would I get only the taxonomy term values that are added to a code in a mymodule_preprocess_node hook? Current term list: value1 (tid=1)...
0
votes
1answer
50 views

Not able to export nodes from one drupal site to other drupal site?

I have 2 instances of same drupal project, where contents are different. I want to export contents from one drupal site to other drupal site. I tried content syn module: I Was not able import ...
-1
votes
1answer
189 views

How do I add an existing paragraph field to another content type programmatically

I have a paragraph field that is already used in a content type. I need to add that paragraph field to another content type using the same field that I was using in the previous content type. How do I ...
0
votes
1answer
60 views

What is the basic concept behind revisons in term of performance? [closed]

On a Drupal 8 project, I am planning to allow revisions to be created for one "content type" which consist of around 40 different fields ! Can someone explain the concept behind on how Drupal save ...
1
vote
1answer
172 views

Get form values into hook_node_insert / hook_node_update

I need to get in hook_node_insert and hook_node_update the value of a field I manually added to a form. function hook_form_FORMID_alter(&$form, FormStateInterface $formState, $form_id) { $...
0
votes
0answers
51 views

How do I add moderation state in a computed field?

I have a D8 content type with content moderation (draft,published, in-progress). I created a computed text field (my_computed_field) and want to add the current moderation state in the field.
-2
votes
1answer
44 views

Memory exhausted during csv upload? [closed]

I am uploading a csv and creating custom nodes. I have set the drupal memory limit to 512M and I can see this in the drupal status report. But when I am uploading a csv file, I am getting the error ...
1
vote
1answer
497 views

Set entity reference revision field value?

How do I set entity reference revision value for a field? I have two fields, field_test_entity_reference and field_test_entity_revision. field_test_entity_reference is of field type entity reference ...
-2
votes
2answers
39 views

Are all my nodes publicly available at their respective links (ie example.com/node/25)?

I'm new to Drupal and working on a pre-built Drupal site. There seems to be a large number of pages that are public with the /node domain path. For example, something like the link example.com/node/10,...
0
votes
0answers
48 views

Redirect after saving referenced nodes

[Note, this question is almost identical to this one for Drupal 7, but since I never used it I cannot understand how the proposed solution can be ported to Drupal 8] I have a parent node type, let's ...
1
vote
1answer
73 views

Date/Time +1h in Node

I have a module to import nodes with a date/time field. All times are correctly written into the database. But when I view a node or in node/edit I get the time +1 h. In Drupal I have set the timezone ...
2
votes
0answers
101 views

Working with hook_node_access_grants

I am currently working with Permission by Term to set simple access control on two node types with terms. As noted here, I believe I found a bug where the access record isn't written the first time ...
0
votes
1answer
201 views

How to add title of the image in manage display section or display it in node view page

I want to display title property of an image in node view page. How can I display title of an image along with image in node page?
0
votes
1answer
32 views

How to get field value after getting a node?

I have a content type which contains school information. School name and school id are two fields in the content type. I have the school ID and I am able to retrieve the node. How do I get the school ...
0
votes
2answers
64 views

how it's possible to load nodes by taxonomy terms

Here im loading nodes by "type" article, i want to call nodes by another id , but this id is in another table, should i join tables , or it is some other way to do this $type = "article"; $...
0
votes
1answer
41 views

How to pre-populate paragraphs when creating a page [duplicate]

I have tried for some time to find out a way to populate a new page with a few paragraphs to save time on most of the pages (but which might change position or even get dropped for some pages) but so ...
1
vote
0answers
246 views

How to get first & last revisions?

I have Article content type. Moderation is enabled. So user will move article from Draft -> Published -> Draft -> Draft -> Published . So all revisions is going to create for each state. $...
0
votes
1answer
45 views

How to customize a link with a custom module?

I installed the "Private Message" module on Drupal 8. There is a link to send a message that I want to transform into a Bootstrap button. How to customize a link on Drupal 8 ? Here is the HTML code ...
0
votes
2answers
257 views

Increase weight range for child pages in book outlines (Book module)

When a child page is added to a book via "Add child page" (node/add/{content-type}), the Weight drop-down field in the Book Outline tab has a range of -/+ 15. This is due to line 191 in web/core/...
1
vote
2answers
89 views

How to increase book weight range for a same-level chapters

I have a book of 33 chapters. These chapters are numbered with roman numbers: Chapter I, chapter II and so on.I'm a blind user, so I can't use drag & drop reorder. In Drupal 7, weight range is -15 ...
0
votes
1answer
66 views

How to force child page added to book outline to top or bottom; update outline without clearing cache

Drupal 8. When you click the "Add child page" link at a book page, you go to "/node/add/content type" where you can create and save the child page. Upon return to the book page (assuming the book ...
1
vote
1answer
111 views

How to update a node after loadByProperties? [closed]

I search for a node with field value client id and I need to update values. How do I do that in drupal 8? I search with the following code $profileNode = \Drupal::entityTypeManager() ->...
-2
votes
1answer
49 views

How tu setup magazine-like content type?

I working on my first Drupal 8 site, and I heard 3 rules about Content Types: More than 5 content types is too much When content are similar (news, articles) is better to do one content type Do not ...
0
votes
1answer
26 views

selecting all field_data_body for all content types

We are trying to search all text_long or text_with_summary fields for all content type nodes. I can do it for the field_data_body. I need to expand this for all content types using text_long and ...
1
vote
2answers
119 views

Add content type machine name as body class

Is there a way to insert a class to the body of the node page? It should be named like the current node type's machine name. Maybe someone could extend this code below with a content type class: ...
1
vote
1answer
40 views

Rendered entity reference field (list-group) disappears, when user can't access the referenced items. Why?

I have been trying to find the reason for this problem for a few days now... without any luck. Which is why I would like to ask for help here... In a nutshell: I'm working on a simple LMS and have ...
1
vote
1answer
92 views

Pass book node id as second parameter to drupal_block(“book_navigation”)?

I'm trying to use drupal_block("book_navigation") in a twig template (with the twig_tweak module installed) to display a list of chapters for a book page. But I'm getting a list of all books and their ...
0
votes
1answer
40 views

Constructing array of term reference labels in php template?

I'm currently trying to set up a simple LMS and have already defined a content type course that contains a term reference field accesstags, which I would like to use for defining view permissions. I.e....
1
vote
2answers
630 views

Pass additional variable into existing twig template (Book module)

I use the Drupal 8 Book module for books where each chapter has a different author. The Book Navigation block uses book-tree.html.twig (core/modules/book/templates) to generate a book tree showing ...
0
votes
1answer
84 views

How to define template suggestions for node add and edit form by content type?

I have a content type Project and it has a more than 100 fields in the node form. The form fields are grouped in different section and category. I tried to use a field_group module to group and ...
0
votes
1answer
147 views

Content type Text field as Geolocation source field in View

I have a text field(named as address) in my content type and I will store the address in that text field. Here I don't want to store the address in geolocation field so I have to use text field to ...
2
votes
4answers
2k views

How to get nid and title from a node array

use Drupal\node\Entity\Node; function abc($v) { $node = \Drupal\node\Entity\Node::load($v); print_r($node); } The array structure of $node is as given below Drupal\node\Entity\Node Object ( [...
0
votes
2answers
52 views

Insert date programatically in custom module

I am programatically saving values from an array $customer into a content type. The below code works fine and populates the content type customer_profile except for the field date of birth. This field ...
0
votes
0answers
16 views

How do I set values for a Boolean field? [duplicate]

I have a content type, I'm trying to add a field that's a boolean. I want the options to be yes or no. This is something I thought would be relatively simple however, I keep getting an error message. ...