A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

Questions tagged [nodes]

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

Filter by
Sorted by
Tagged with
1
vote
2answers
21 views

How to show a block between the body and a paragraphs field?

For a larger article content type on a Drupal 8 page, I want to have the following structure: Title Image/Video Body (the normal node body with the title and some text) A contanct block Paragraphs ...
0
votes
0answers
16 views

Solution for Job application form with file using NUXT + DRUPAL

Ok, so I am working on a project (Using NUXT.JS for frontend) for a company where I need a job application form. I am using Drupal as headless CMS. Everything is fine so far. I have created multiple ...
0
votes
1answer
13 views

Send view field in URL - Drupal

I have a search page created with embedded filters in Drupal 8 View. In the list of fields I have a fields - [Field_program_id]. I also have a button 'Learn more' when clicking this button I want to ...
0
votes
1answer
17 views

Page Content Type: Displaying error in Preview mode

Whenever I am creating or editing my page Content Type and go into preview mode I see these errors: And here is the code for it: The dark theme does not show up in preview mode though. However, if I ...
0
votes
1answer
19 views

how disable edit for a certain content type, and a certain role,

in a drupal 7 site i have been given to maintain, it seems that permissions are not working as expected. I check and uncheck the buttons for a certain user role, but that user role always has the ...
2
votes
1answer
21 views

Why would a multilingual site sometimes say “Save (this translation)” and other times say “Save (all translations)”?

We have a multilingual Drupal 8 site supporting 17 different languages and many more localized versions of those languages. I have been noticing that sometimes when I am editing a node it says "Save (...
0
votes
1answer
43 views

hook_node_update not working

I placed the following function in my custom module. function MYMODULE_node_update($node) { if ($node->type === 'page') { $node->title = 'test'; } } When editing and saving a node of ...
2
votes
2answers
31 views

How do I add fields to the sidebar menu when creating/editing nodes?

I would like to add to the sidebar menu on the create/edit node pages. How would I do this? I would like to do this in order to make the content creating/editing a little cleaner and easier to ...
0
votes
1answer
19 views

How can you identify all nodes that use a certain paragraph type or template?

In Drupal 7, given a custom paragraph bundle and an associated template file, is there a way to list all the nodes using that bundle? Or, if it's any easier, a way to do the same for a specific module ...
1
vote
0answers
37 views

Is it possible to modify the node edit form in a constraint validator?

Is it possible to manipulate the node edit form after it fails a constraint validation? My scenario is as follows if a user attempts to save a node and fails the constraint validation a validation ...
1
vote
1answer
27 views

Why isn't the value for a new Boolean field rendered?

I added a new Boolean field to a content type. For some nodes, I did set this field. Still, the field value is not shown on the node page. Why? I realize that, as long no value is set for ...
2
votes
1answer
24 views

How can I check to see differences across my multisites?

Currently, we're using Acquia Content Hub to syndicate content across our sites with a spoke and wheel syndication architecture. We essentially use a single site (that content editors use to create/...
0
votes
1answer
85 views

Node content is not shown

I installed DrupalGap. Everything works fine so far, except that the node body is not displayed. I have none of the mentioned interfering modules installed. I also tried with a fresh Drupal 7 ...
0
votes
0answers
24 views

$node-date field changes to array on submit

Drupal 7, I have a simple custom content type. When I edit the node and set a breakpoint in node_form_submit(), the $node->date field is getting changed from a timestamp string to an array, with ...
0
votes
0answers
43 views

Query params in url does not appears in node url after updating

I need to append node path programmatically to make the url look like [the link]?utm_source=Home%20Page&utm_medium=website&utm_campaign=AB%20Test&utm_content=Headline A I'm updating node ...
-1
votes
1answer
32 views

How do I create a view for a single node? [closed]

I have a Company details content type used to create 20 nodes. I created a view for that content type which displays all its nodes. I want to create a view for a single node. Is it possible? How?
0
votes
1answer
33 views

Getting error {“message”:“No route found for \u0022GET \/standortimporter\/region_node_rest_resource\u0022”} custom rest POST

I am creating custom rest resource using this code: <?php /** * Provides a resource to get view modes by entity and bundle. * * @RestResource( * id = "...
1
vote
0answers
36 views

How do you update node menu links?

I am creating Drupal 8 node using code and same time I am assigning a menu link as well its working fine. I am creating a menu using this code. MenuLinkContent::create([ 'title' => $item['...
-2
votes
0answers
33 views

How do I limit who can edit a node?

On my site, everybody can edit a node. Six hours after a node has been created, only administrator users should be able to edit it. How can I implement this?
0
votes
1answer
47 views

Get the ID that for the node that has been just created

I am trying to get the node ID that I have just created. If I do the following code from this answer. $node = \Drupal::routeMatch()->getParameter('node'); if ($node instanceof \Drupal\node\...
0
votes
1answer
43 views

How to count the number of comment and flag in a node?

I want to display on my node the number of comment and flag. What should I add to my TWIG to get this? How to count the number of comment and flag in a node? Here is an example :
0
votes
0answers
14 views

How do I disable the “Add to cart” button when a user has already a product in the cart?

I need to sell a node on my website and I'm using the Ubercart and Paypal Express Checkout modules. It works: I can buy a node by clicking on the Add to cart button on the product page and Checkout ...
1
vote
1answer
23 views

Entity relation field view

I have a D8 entity reference field question. I have 3 content types: Student, Class, Book. A student can have several classes and a class can have several books. I have in student an entity ...
-1
votes
1answer
18 views

How to Update db field value in hook_menu()?

I'm using Drupal 7, my requirement is to automatically update the node field value in a content type for a condition. I have used Hook_menu() for to get a link and if i use that link my code will ...
0
votes
1answer
47 views

Set taxonomy field on node creation [closed]

I have a node type 'blog_entry' that uses a taxonomy reference (tags). The tags are created if they don't already exist, i.e. the reference field uses the option 'Create referenced entities if they ...
1
vote
2answers
55 views

How can I retrieve the current node ID on a custom route?

I have a new route and the yml file looks like this: rsvplist.form: path: '/rsvplist' defaults: _form: '\Drupal\rsvplist\Form\RSVPForm' _title: 'RSVP to this Event' requirements: ...
0
votes
0answers
35 views

How do I create an entity reference from a webform submission?

I have two content types : Parents and students. each content type has a entity reference to the other content type. I am using module : webform and webform creator to create the content. Once a ...
-1
votes
1answer
48 views

Is it possible to get the node ID of the node that will be created?

Trying to pass some information to third party API, every time a new node is created. So far I have managed to identify the node insert/create when a node is created in hook_node_presave(). Done it ...
1
vote
1answer
23 views

Drupal 8 correspondence to node_access function on Drupal 7

I feel like asking a silly question, but here it is anyway: I need to test if a given user (in my case, the logged in, current user) has access to a given node for one of the existing operations (view,...
0
votes
0answers
25 views

How to render related nodes by vocabulary X on vocabulary Y terms?

I did many research about related nodes by term. These solutions are good with related nodes by term on node pages but does not work on term pages. Solutions I found: Add "Content: Has taxonomy term ...
0
votes
0answers
15 views

Ensuring a smooth node-add routine

I am building a site in Drupal 8, where users can add training programs. An example of such a program could look something like this: The way I see it, I will need 3 node types: Node type 1: Program (...
0
votes
1answer
29 views

How to display since when the node was created? [duplicate]

How to display since when the node was created with TWIG. Here is the templace of my node : <div class="card mb-5 p-0 overflow-hidden shadow rounded bg-white"> <div class="card-header ...
0
votes
0answers
10 views

How to display field labels in Views lists that show full content or rendered entities?

I have a view that displays multiple content types and for this, I went and created custom displays. It works fine except that Views seem to strip all fields from labels. I did a dump of twig fields ...
0
votes
0answers
38 views

Type-specific fields for different categories of content type

I have a contract content type on my Drupal 8 site, and I would like to use the same content type for multiple different types of contracts. 95% of the fields are common for all types (contact ...
0
votes
0answers
25 views

How to create a table-structured content type?

I am creating a content type which needs to be in table format. The table structure looks like below: Main title for the table 1: ........................................................ First row ...
-4
votes
1answer
24 views

Why is my db_query not working? [closed]

i am trying to display my content types and their info in a table format. First thing i want to do is make sure i am connected to the database. It seems i cant connect to the database. Please assist. ...
1
vote
1answer
56 views

How to delete all revisions of given content type except the current revision?

I am having a very large website which have around 400000 nodes of story content type. And these nodes have around 2000000 revisions. How can I delete all the revisions except the current revision so ...
0
votes
1answer
43 views

Limit multiple fields node add form

How can I (either with a module or programmatically) limit the number of values for multiple fields? For example, the user can add only a single value for field A OR field B OR field C. The total ...
0
votes
1answer
49 views

Filter nodes by paragraph user reference

Say you have a content type Exercise which has a Related Users paragraph field. In turn, Related Users has a user reference field: (content type) exercise --> (paragraph) related_users --> (user) ...
0
votes
0answers
26 views

How do I select which node fields to display while typing in an entity reference field?

I created an entity reference field to select News items to display on a page. News is a content type. How do I display not only a title, but other stylized fields of a node as I type in the entity ...
0
votes
1answer
11 views

Fill the “Unpublish on” date field of the Scheduler module depending on list field

I have a content type, where I want to give the user only three possibilities to unpublish content: in 1, 3 or 6 months. For the selection of the three options I use a list field. How can I transfer ...
1
vote
2answers
224 views

Where is the node created timestamp stored in the database?

I need to create an SQL query that finds all nodes of a certain type created X days ago, so I can get their IDs. Due to the massive number of nodes in the database, I would prefer to use a direct SQL ...
2
votes
1answer
45 views

How do I programmatically delete a node by internal url alias?

How do I programmatically delete a node with a specific internal url alias? Background: We are trying to delete this node so that it can be replaced during an update hook.
0
votes
0answers
21 views

Insert data into the database [duplicate]

I try to save some data I get into a form in the database but I don't know how to do it. Currently, here is what I have in the database (I try to add articles). As you can see I already have 2 of ...
0
votes
0answers
21 views

Status on node is not changed during query update

I'm updating a node's status to unpublished and the status in node_field_data is changed from 1 to 0 but in the content view, status is published and when editing the node, the publish checkbox is ...
1
vote
1answer
37 views

If content type with specific field that is not empty has specific taxonomy term attach library [closed]

I would like to attach a specific library using a taxonomy term to a content type with a specific field that is not empty. The following is not working: function lehigh_preprocess_page(&$...
0
votes
0answers
25 views

Services module retrieve node with PHP text format

I have successfully connected to a Drupal instance using JSON and even retrieved a node using the service. Problem is that the node has php content type, and the service returns the raw php content ...
-1
votes
1answer
61 views

Function to get node view mode name

I've been using $node->getType(); to get the content type. For view mode, I am following this method: Is there a function similar to getType() (that doesn't require adding a preprocess ...
3
votes
1answer
40 views

How do I free the memory used from node_load()?

I am using code similar to the following one. for ($i = 0; $i < 1000000; $i++) { $nid = get_node_id($i); $node = node_load($nid); $data = [ $node->field_1, $node->field_3, ...
3
votes
2answers
95 views

How to get node's view mode in hook_page_attachments?

I need to get the node's view mode so that in the mymodule_page_attachments, I can add libraries conditionally if the node's view mode is set to full or default. I tried the following but not able to ...