Questions tagged [nodes]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
21 views

Getting the version history of a node

Is there a way to get the versions history of a node using REST or JSON API? I would like to be able to view all version IDs of a node in JSON format.
0
votes
1answer
58 views

Within a node template how can I tell what regions are in use/ occupied?

I am trying to create a preprocess function in my .theme file in order to make a variable available to node templates. I want the variable to contain just the names of all regions that are currently ...
1
vote
0answers
13 views

Custom display in saved Entity reference in Widget field

We have an entity reference field widget. Based on a view where you can enter the code of a product to get to the product reference. The widget shows the 2 fields (code) - (Title) when we type in the ...
1
vote
0answers
25 views

Creating default content on site install with related entities

We use the Default Content module to install default content on each new site of our multi-site Drupal platform. Version 2 changed to only use UUID of the content you are exporting (done from the ...
2
votes
0answers
228 views

Missing bundle for entity type node after upgrading

I recently upgraded a local sandbox to Drupal core 9.2.4. While testing things out, I got an error when trying to add a new article content from /node/add/article. The log shows the following message. ...
0
votes
1answer
30 views

Custom Migration Plugin MySQL Error

I've run into the following error when running the command drush migrate-import custom_spotlight where custom_spotlight is the name of the plugin. I've been following along with this guide: https://...
-1
votes
1answer
31 views

drupal custom callback in node edit form is not firing

i am fairly new to drupal , i have custom button added to one the content type edit page , when i click on that button i want to call a function but it seems like it is not calling function when i ...
0
votes
0answers
30 views

How to get the field data

Hi i'm using entityreference, i hava an content type"test" that contain a field that refer to categorie and this categorie contain a field_theme also referenced to another content type ...
0
votes
1answer
18 views

How do I display a tour on a node?

On a Drupal 9 site, I installed the Tour and the Tour UI modules, and created a node. How can I configure the Tour UI to show a tour on that node? I don't know what to put in Module name and Routes.
1
vote
1answer
26 views

How can I make 3 different menus?

I need to do an Agenda in Drupal 7. The table for the events is more or less already done, but I would need to add 3 days on the top like: Day 1 - Day 2 - Day 3 Depending on which day is ...
0
votes
2answers
41 views

How can I use contextual filters to display a block with field values from a single related entity?

I've found various recipes/threads with the scenario where have a content type A node and want to display in a sidebar block, all the related content type B nodes, with the relationship based on an ...
0
votes
0answers
11 views

Display in f2 only terms related to selected term in f1

I have a site that consists of a few parts like: Cosmos, Hi-tech, Travel, Music. Each part has its own Categories. And I have made two Taxonomy vocabularies: Part of a site Categories (this has field ...
1
vote
1answer
51 views

Programmatically verify a taxonomy term has been added to a node

I'm currently checking the node type and status, using the following code. $query = \Drupal::entityQuery('node') ->condition('status', 1) ->condition('type', 'content_page') ->execute();...
1
vote
0answers
38 views

Edit a node in the settings tray?

I am looking at this page in the Drupal docs for the Settings Tray and wondering if this can be used to edit the current node you are looking at, similar to this image: Is there a way to edit all of ...
0
votes
1answer
21 views

Display Node Local Tasks Menu on View

I have a view that shows registrations for an Event (Content Type). This tab is shown in the /node/{node}/edit: This registrations tab refers to the view, which I have inserted in the routing.yml: ...
1
vote
1answer
86 views

Add a hero image and text when a node goes from unpublished to published

I'm trying to add a hero image and text when a node goes from unpublished to published. The things include: Add an image from my media library to a media field on the node Add a page title to the ...
0
votes
1answer
63 views

How to add a secondary Ajax submit to a regular node form?

I'm trying to add an Ajax submit to a regular node edit form (Drupal 9). I'm using Field Groups so that there's a series of tabs, and I've added a pair of "buttons" (Right now they're just ...
0
votes
0answers
22 views

Get the breadcrumb inside my node template [duplicate]

How can I move my breadcrumb from my page.html.twig into my node--content-type.html.twig ? In my page template, I display the breadcrumb like this : <div id="main-wrapper" class="...
0
votes
1answer
74 views

Get path (alias) from SQL query

I have a SQL query to get all nodes with their ID, title, publish date, change date, etc. Additionally I need to get path to each of them (probably from path_alias.alias). Now I have following (...
1
vote
1answer
212 views

Programmatically publish unpublished nodes

I want to publish unpublished nodes in a custom action. To do this, I query the database on a specific condition and want to use 'exists' condition to find the node IDs to publish. This is the code I ...
-1
votes
1answer
30 views

Set "select" field on a node programatically

I am creating nodes programmatically on a specific content type. The content type has a "select field" that I am trying to set value with and cannot do it. Below is my code: $node = \Drupal:...
-3
votes
2answers
49 views

Display all the nodes from a specific content type on the front page

I have a custom content type (news). I want to show all those nodes on the front page. How can I achieve this?
0
votes
1answer
47 views

Can't add an image extension to the field_image of the Article content type

I need to upload an image with the webp extension and add it as the main image of a content item with the "Article" content type. Since its field_image doesn't have the webp extension by ...
2
votes
1answer
176 views

How do I programmatically publish the latest revision?

My workflow is draft and publish. I create and publish a page. I create a draft of the page. There is now the published page, but the latest revision is the draft. How do I programmatically set as ...
0
votes
0answers
24 views

Is there any possibility to capture an array with all nid of a view?

I tried using hooks but in $view->result variable I only get nodes from the actual page (10 nodes because pager size is 10). My view has multiple exposed filters so I want the resulting nodes from ...
0
votes
1answer
34 views

View Bulk Operation with custom action

I have a custom action to update some table values base on node content selection. My custom actions are listed correctly on bulk update select box. But I can perform operation some random node ...
0
votes
0answers
22 views

New node of content type always as new book

I have two content types: my-book and my-page. Is it possible to automatically create a new book (using the Book module) when a my-book node is created? I was looking into using hook_node_presave(), ...
0
votes
2answers
82 views

How can I add a node template suggestion by node title?

Twig debugging is suggesting node--4.html.twig as template file for a node whose ID is 4. Since the node ID changes when changing environment, I would need to use a template file whose name is based ...
1
vote
1answer
13 views

Add relationships that has 3 layers, Parent -> Child1 -> Child2

Recently I asked a question that was similar (Parent node needs to display the scheduled date that is referenced in the child node), but requirements have changed and now I'm dealing with the Node A (...
0
votes
0answers
30 views

Avoid sending email (content moderation) when node updated programatically

I have a csv import function which also will have to update the "moderation_state" field. Once csv import is ran, email will be triggered by content_moderation module. Is there a way to ...
0
votes
1answer
60 views

How can I view the list of referenced nodes when viewing a node?

I have a content type with a Related pages field, which an entity reference field for nodes. How can view those nodes while still on the current node? I tried to achieve this by creating a block view, ...
1
vote
1answer
21 views

Parent node needs to display the scheduled date that is referenced in the child node

I'm not sure how best to approach this problem and I'm hoping someone can point me in the right direction. Quick summary of the setup of some nodes: Node A is the parent node. Node B is a child of ...
0
votes
1answer
61 views

What is the equivalent of Joomla's {loadposition} and {loadmodule}?

I have recently converted from Joomla to Drupal. I am still learning how to use it but I can't seem to find answers (esp for Drupal 9 not some ancient version usually coming up with google search) how ...
0
votes
0answers
27 views

ckeditor not loading rich text editor by default

I'm running CKEditor 7.x-1.19 with Drupal 7.80. With "Default editor state" set to Enabled, and "Show the disable/enable rich text editor toggle" set to Show, my system is still ...
1
vote
0answers
47 views

How to target the initial revision of a node?

How to target the initial revision of a node? This gives me a list of node IDs in which the latest revision of the node is of author $user->id(): $query = \Drupal::entityQuery('node'); $query->...
-1
votes
1answer
44 views

Add custom form to content type (Basic Page or any) using custom extesnion

I am new to Drupal. Actually, I have to add a custom form to the content type and it will be visible to the frontend user where they can submit their response. So I have created the form and save the ...
0
votes
0answers
21 views

File for template suggestion not picked up

I am using suggestions for a node , I have in the html source the suggestions: node--1.html.twig, node--1--article-list.html.twig, node--article-list.html.twig, and node.html.twig Whenever I use ...
0
votes
0answers
20 views

Webform email token from node field

In my drupal webform I have a node field ('custom_email_text') which is populated by a node id. I need the connected node text to be rendered in the email that is sent after the submission. I tried ...
0
votes
1answer
46 views

Show latest changes in node "View" tab while using Content Moderation

I had been trying a lot to display latest revision into view tab irrespective of its state, so if a node is in "Draft" state I still want it to be displayed under "View" Tab rather ...
0
votes
1answer
40 views

How to display the first child of a book with the title of the book and keep the url by using a view

Is it possible to display the list of the first child of every book with a view? I couldn't figure that out so I added boolean to the book content type to check which child is the first child. If that'...
0
votes
0answers
28 views

How to embed image field url in API response?

I have a content type that has a title, body, link, and image field. Then in my php file I have the following: $articles = \Drupal::entityTypeManager()->getStorage('node')->loadByProperties(['...
1
vote
0answers
32 views

How can I restrict selectable terms in a term reference field to only show those which have been used earlier by the same user?

I have a node (type = List) with 2 fields, Term Name and Body. Body is a long text type field and Term Name is a entity reference field, which is a drop down with a list of Term in Vocabulary Vocab. ...
0
votes
1answer
39 views

Get taxonomy field value in forum-list.html.twig

I am customizing the appearance of the forums. I added all my forums and container. Additionally, I added a custom taxonomy field I need to show for each forum category. How can I show the custom ...
0
votes
1answer
29 views

How to add an article to a page automatically

What I want to do is to add the title and the body of an article I create on my homepage just as you would do it for a news. I've been trying to make this work but I can't find a way to do it without ...
0
votes
0answers
112 views

How to use Blazy in a custom Twig with Responsive Images and WebP

I have a node twig template and I'm rendering Responsive images like so: {% set pmpFact1Path = node.field_pmp_fact1_image.entity.uri.value %} {% set pmpFact1ResponsiveImageStyle = { '#...
0
votes
2answers
61 views

How can I copy a body field from one node to another node?

I'm trying to write a small module that copies the body content from one node to another node. The module does almost what it should and everything arrives so far. However, I have to open the node to ...
-1
votes
2answers
46 views

How many child pages can be added under a book parent item?

When using the Book module, is there any limit on the number of child items that can be added to a book parent node?
1
vote
1answer
54 views

how to set a node to anonymous author?

Change node author works : $node = \Drupal\node\Entity\Node::load($nid); $node->set('uid','45'); $node->save(); But i don't know how to set it to anonymous user ? or unset it ? $node = \Drupal\...
0
votes
1answer
25 views

Block the node which I am currently in

I am discovering one problem on my page - as a content I have some recipe. Under it, I've created a block which is displaying "Simular recipes". And now, this block is displaying some ...
1
vote
1answer
42 views

Implementing hidden content parts (as in old "Hidden Content" module)

There is (long unsupported) "Hidden Content" module, allowing to insert content blocks visible by certain roles only, i.e. like below: [hidden role="Role Name"] ...content ...