Questions tagged [nodes]

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

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

Anonymous users can edit all anonymous users content

Drupal has a edit own content permission for each content type. I have given the Article: edit own content to anonymous users and discovered that Drupal doesn't differentiate between different ...
user avatar
0 votes
0 answers
21 views

How to offer the GPX file for download, on the node?

I installed the "Geolocation Field" module on Drupal 9. In my content type, I created a "Geolocation GPX File" field to load a GPX file. I loaded a GPX file in the node field : ...
user avatar
  • 1
0 votes
0 answers
15 views

Pull value from a node field based on another field

I want to be able to update the value of a field based on taxonomy term. I have a term (location) with a custom field (country) and city with corresponding values in this term. I create a reference ...
user avatar
  • 1
0 votes
1 answer
34 views

How to add parent terms of a taxonomy term?

On my Drupal 9 site, I have an "Article" content type with a taxonomy reference field_tags. This field is configured so that the user can choose the appropriate term from a drop-down list. ...
user avatar
  • 1
0 votes
0 answers
27 views

How do I create a block that displays nodes related to the current page?

I have a taxonomy vocabulary (Tags) with the following terms. term 1 term 2 term 3 term 4 term 5 term 6 term 7 term 8 term 9 term 10 term 11 term 12 term 13 term 14 term 15 term 16 I have an ...
user avatar
  • 11
0 votes
0 answers
44 views

How to display nodes that belong to the same taxonomy term as the current page?

I created a "Categories" taxonomy vocabulary with the following terms and child terms : - Crypto -- Binance -- Ledger -- Metamask - Geek -- Security -- Apple ... The "tags" ...
user avatar
  • 33
0 votes
1 answer
25 views

Run hook_preprocess_node only for main page

Is it possible to run hook_preprocess_node() only for the main page, and not for the referenced nodes that are on that same page? I am using the following code, but it doesn't feel like the best ...
user avatar
  • 892
-1 votes
1 answer
27 views

Add paragraph value to referenced node [duplicate]

I have a paragraph with two field: Paragraph title [text field] Node [entity reference field] The node is displaying its title and an image. By default the Node title is a H2 heading. But I want it ...
user avatar
  • 892
-1 votes
0 answers
34 views

How do I center the map on the GPX track with Geolocation Field?

I created a Track content type with a Geolocation GPX File field. I imported a GPX file. When I visualize the node, the map displays the ocean. The settings in Manage the display don't allow to center ...
user avatar
0 votes
2 answers
33 views

Title fields are displayed as a link

For me, all referenced fields or all title fields are displayed as links. This fits in the node as well as in views. However, I don't want this at all, but I would like these fields to be displayed ...
user avatar
0 votes
0 answers
32 views

How to show summary of a node in CKEditor?

I have a website built with Drupal 9. I publish many articles on it and I would like to display in my articles, the summary rendering entity of other articles related to my writing. I know this is ...
user avatar
0 votes
0 answers
36 views

Twig Tweak 3 and drupal_field in node twig template

I have a Drupal 8 site with Twig Tweak 2 which I've upgraded to Drupal 9 with Twig Tweak 3. This has broken a custom node twig template. With Twig Tweak 2, this worked: {{ drupal_field('...
user avatar
  • 77
0 votes
0 answers
7 views

Hide only one field from view for empty contextual filter

I have a view with the following structure: Here's the response in close-up: My requirement is to hide thecontent field for an empty contextual filter value i.e when we call /sync/newslist. The ...
user avatar
1 vote
1 answer
64 views

Use path alias as contextual filter

I have nodes in Drupal for News Articles that generates this automatic URL alias. I also have a view for News nodes. This is the data. The problem is that I can't use Content: Path (url) or Content:...
user avatar
-1 votes
0 answers
41 views

Show title of a referenced node

I have a node type of "Countries" and node type of "Continent". On the "Continent" node type, I created a referenced field of countries (field_countries). On my Countries ...
user avatar
  • 1
0 votes
0 answers
27 views

How do I pass a variable to a template file?

I have a template that defines a module that builds a paragraph. This paragraph uses a field reference to link another type of content. In my main paragraph I call this reference content with {{ ...
user avatar
  • 101
0 votes
1 answer
35 views

How can I update the node date for all nodes

I have imported a number of nodes to a fresh installed Drupal 9. Later, the original content creation date (from the previous website) became important. I have the information according to the new ...
user avatar
  • 15
0 votes
0 answers
50 views

Programmatically attach an image to a field

I am using Drupal 9.3.13 on localhost. I generate successfully a QR Code based on the .SVG format and store that image on public://. I created various field types, one of which is a field_file_svg ...
user avatar
0 votes
0 answers
28 views

Get link value from menu link

Let's say I have created a new menu node under Structure -> Menu. The name of the menu is "Footer" and for this I created a new "Menu link" called "imprint" which has ...
user avatar
  • 1
1 vote
0 answers
29 views

Sending data to custom block [closed]

I created a module that has several pages of administration. One of these pages is a block creation page. When the block is created the name of the block is kept in the database. The block build() ...
user avatar
  • 11
1 vote
1 answer
93 views

Method getTitle() returns an unexpected value. What causes this?

In an implementation of hook_node_insert(), I have the following three lines of code: dpm($entity, 'entity'); $title = $entity->getTitle(); dpm($title, 'title'); From the first dpm() I get: entity ...
user avatar
  • 14.8k
-1 votes
1 answer
24 views

Unable to add newly created term to the node

I want to add new taxonomy term to group of nodes that have specific terms already. To retrive them I use this function function getNodesByTaxonomyTermIds($termIds){ $termIds = (array) $termIds; ...
user avatar
  • 1
0 votes
1 answer
46 views

How to put a phone number in one place and call it from various other places? [closed]

Let's say I want to store my phone number in some "Drupal variable" and then call it anytime I need it, in, say, a node or a block. The purpose is not the repeat the phone number and change ...
user avatar
  • 15
0 votes
2 answers
47 views

Access Denied for programmatically added file to a node

I have a custom script that imports contents from an external database. I'm attaching files using the below custom code. $file = File::create([ 'filename' => $new_filename, 'uri' => $...
user avatar
  • 11
-2 votes
1 answer
46 views

502 Bad Gateway on editing or creating only for one content type

Drupal 9 project. I can create and edit all content types but one. I get a 502 Bad Gateway from Nginx. Theese are the logs: 2022-05-05 10:39:11 Error ***.**.***.*** 503 GET /node/6095/edit?...
user avatar
  • 11
2 votes
2 answers
175 views

Node ID caching on hook_form_alter()

I have a webform with an email field. I am embedding the webform on each node, with a field on the node for the email address. I implemented hook_form_alter() in my .theme file that loads the node ...
user avatar
1 vote
1 answer
29 views

How can I disable revisioning on specific node field

I currently use hook_entity_extra_field_info() and hook_ENTITY_TYPE_view() to create a custom field displayed in nodes that generates content dynamically via PHP. However, Drupal 9 seems to be ...
user avatar
  • 253
0 votes
0 answers
54 views

Update field without node save

I am a beginner in Drupal, I would like to insert a value into a node field. But instead of a node->save() I want to avoid any presave hook and insert it directly using sql query. I have the ...
user avatar
0 votes
0 answers
51 views

list_string field data disappears after making edits to node

I am maintaining a Drupal 9 site that I inherited. Unfortunately, if I attempt to edit any of the nodes, all the fields of type list_string are empty in the next revision. I did notice that the ...
user avatar
0 votes
0 answers
20 views

Perform and store a calculation from a common field in two different nodes

Summary I am collecting survey results - one for a pre-test and one for a post-test and I am looking for a way to automatically generate a calculation on a numerical field in two nodes (one pre-test, ...
user avatar
-2 votes
3 answers
122 views

How do I show a block with a unique QR for each node? [closed]

There is requirement where I need to Place a Block on node where each block will be having the Unique QR code. I created an hard-coded QR code block with the following code. public function build() { ...
user avatar
  • 351
0 votes
1 answer
23 views

Can't save field translation

I have 2 languages on my site (English and Russian). I also have a content type "Home page" and some fields are translantable (configured in admin/config/regional/content-language) After ...
user avatar
  • 1
1 vote
1 answer
70 views

Get the node title field value in the form_state

Drupal version 9.3.9. This is a process of Ajax callback, where the value of the title field is required. In the form node add, the title is displayed. It seems that the form_state does not apply to ...
user avatar
  • 63
0 votes
2 answers
59 views

How can I change the title of the node/add page of a specific content type?

I want to change the title of the node/add page of a specific content type. Twig debug only shows me file names that would also change the titles of other content types. There was a module for this in ...
user avatar
1 vote
0 answers
41 views

Create a PDF from a node after the node is deleted

I want to create a PDF from a node when the node is deleted. I am rendering the node using the following code. $entity = \Drupal::entityTypeManager(); $view_builder = $entity->getViewBuilder('node')...
user avatar
  • 11
1 vote
1 answer
32 views

Post data to term field through JSONAPI

Trying to create node via JsonAPi. It contains a term field and text field. Managed to post text field without any issues but struggle to post values to term field. Anyone guide me to post values to ...
user avatar
  • 123
0 votes
1 answer
102 views

How can I get the canonical path with {{ path('entity.node.canonical') }}

When I use {{ path('entity.node.canonical', {'node': node.id}) }} in a node template file, it renders the path alias. How can I get the canonical path?
user avatar
  • 239
0 votes
0 answers
28 views

How can I display a field from the current node?

How can I create a view block that displays a field from the current node? It looks like there are contributed modules that provide this functionality, but it seems like it should be possible to ...
user avatar
2 votes
0 answers
76 views

Why isn't an image from the local domain shown with the explanation that, for security reasons, only images from the local domain are allowed?

I'm running Drupal Core 9.3.7, with basically the default set up. The Basic HTML editor is CKEditor. If I include an image in a page, that image is not shown when I view the page; on inspection, it is ...
user avatar
0 votes
2 answers
57 views

Render block in a view twig template

I need to render the output of a block within a view / node template (node--news--full.html.twig). Using {{ page.blockName }} does not return anything as {{ page }} within a node view simply returns a ...
user avatar
  • 163
1 vote
0 answers
68 views

How to add complete value programmatically with Smart Date module?

Iam using module Smart Date on Drupal 9. And required programmatically add value to node in field with recurring rule (like Repeats every 1 year on xxxx-xx-xx). Technically, for this action also ...
user avatar
-1 votes
2 answers
59 views

Should I use an entity reference for nodes or taxonomy terms?

I'm dealing with a plant content type that currently contains a paragraph field. The paragraph contains an entity reference to Common name and an Origin text field (with the setting to create if it ...
user avatar
3 votes
1 answer
25 views

Multi-lingual Content Moderation

I have two languages (English and French). I want to: Explore options to create/review/approve/publish English content as its own workflow Explore options to create/review/approve/publish French ...
user avatar
0 votes
1 answer
31 views

Private File Permissions Not Working for a Single file - Can't Identify where to find error

I have the following set up: Private file field configured on content type Access control configured with referenced user having permission to view file If user is referenced on the node, they can ...
user avatar
  • 273
2 votes
1 answer
179 views

How can I load the last nine created nodes?

I want to get the latest nine nodes in a preprocess hook. I am using the following code, but it returns all the news nodes. $entities = \Drupal::entityTypeManager()->getStorage('node')->...
user avatar
  • 163
0 votes
1 answer
47 views

How to programmatically append fields to node object when cloning with createDuplicate()

I am trying to setup a custom module which copies values from a node whose content type is A to a node whose content type is B. For the most part, the content types have the same fields, but B has a ...
user avatar
  • 1
2 votes
1 answer
75 views

Cannot resave nodes with entity->save(), no particular error

I'm trying to write a drush command to resave all the nodes on my site. I searched for a module and found the Resave All Nodes module, but its drush command isn't ready yet. So I decided to try to ...
user avatar
0 votes
0 answers
9 views

how to select for revisions of one language?

the node revision delete module do not distinguish the language of the revisions. The sql query for candidate revisions of each node is : SELECT t.vid AS vid FROM (SELECT r.vid AS vid, r....
user avatar
  • 2,775
0 votes
0 answers
32 views

Summary not creating output in meta tags

I have inherited a Drupal site that I can not update the modules or core. I have 500+ pages with blank meta description due to [node: summary] not working. [Node: title] works fine, and while ...
user avatar
0 votes
0 answers
19 views

How can I avoid that deleting fields from B deletes also fields in A?

I have two content types: A and B. B has a entity reference field to A. There are some fields in B which autofill from values in A. When any of the fields which are used to autofill are removed from B,...
user avatar

1
2 3 4 5
150