Questions tagged [nodes]

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

Filter by
Sorted by
Tagged with
0 votes
2 answers
299 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' => $...
robdex's user avatar
  • 11
-2 votes
1 answer
636 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?...
fombo's user avatar
  • 11
2 votes
2 answers
420 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 ...
Stephen Ash's user avatar
1 vote
1 answer
217 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 ...
Anton's user avatar
  • 273
0 votes
0 answers
192 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 ...
el sparrow's user avatar
0 votes
0 answers
53 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 ...
nschildre's user avatar
-2 votes
3 answers
383 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() { ...
Akki's user avatar
  • 381
0 votes
1 answer
101 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 ...
John's user avatar
  • 1
1 vote
1 answer
409 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 ...
Belba's user avatar
  • 71
1 vote
2 answers
562 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 ...
0711master's user avatar
1 vote
0 answers
79 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')...
Nyn's user avatar
  • 11
1 vote
1 answer
380 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 ...
srini's user avatar
  • 129
0 votes
2 answers
1k 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?
mevsme's user avatar
  • 1
2 votes
1 answer
330 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 ...
Phil Evans's user avatar
0 votes
2 answers
772 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 ...
mauzilla's user avatar
  • 173
1 vote
1 answer
488 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 ...
Eduard F.'s user avatar
0 votes
2 answers
178 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 ...
turpentyne's user avatar
3 votes
0 answers
137 views

Multi-lingual Content Moderation [closed]

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 ...
Somoshri Ghosh's user avatar
0 votes
1 answer
45 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 ...
Scott's user avatar
  • 273
3 votes
1 answer
875 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')->...
mauzilla's user avatar
  • 173
0 votes
1 answer
206 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 ...
Piet's user avatar
  • 1
2 votes
1 answer
467 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 ...
Patrick Kenny's 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,...
Sherry K's user avatar
0 votes
0 answers
96 views

Publishing Options for Content Type Not Showing

I am on version 9.3.2. When I change the Publishing Options for any content type, nothing changes on the node's edit page or the new content page. Not sure when this changed, but a year ago it was ...
Jim D's user avatar
  • 11
0 votes
0 answers
39 views

Entity route requirement not working

I'm trying to get the following route working but the entity bundle requirement won't work. If I switch requirements to _access: 'TRUE' it works but entity checks are not working. I've traced it to ...
Lambic's user avatar
  • 708
0 votes
1 answer
52 views

Drupal 7 and/or CKEditor adding paragraphs to code breaking styling

I've recently started a new job where I'm managing a Drupal 7 website for the first time. We will be moving away from this platform soon, but I have to maintain this site for the time being. I'm ...
new_to_drupal_librarian's user avatar
2 votes
1 answer
91 views

$group->addContent() in hook_node_insert() doesn't update the access permissions for the node

I have a content type with a field that lets the users decide which group to add the content to. The content is added to the group via hook_node_insert(). function tm_wiki_node_insert(NodeInterface $...
stemiwe's user avatar
  • 21
0 votes
1 answer
94 views

The values returned from hook_node_access_records() aren't considered to allow access

I am implementing a solution in Drupal 9 where users are allowed to see only the nodes that belongs to their same group. If a node doesn't belong to any group, t hey should be able to see it. I've ...
Yasen Ivanov's user avatar
2 votes
0 answers
227 views

How to publish latest revision langcode programmatically in each translation

My workflow is draft, publish and archived. My translations are 'en(default)', 'fr', and 'de'. My clients create a lot of nodes in draft status for their release. We must release these latest ...
Taku Fujita's user avatar
1 vote
1 answer
132 views

Existing pages not editable for admin with all permissions

You know the drill. User of various CMSs but new to Drupal and inherited a site running version 8.6.10. New pages (nodes?) can be created but once something is created, nothing on/under the Edit tab ...
newtodru's user avatar
1 vote
0 answers
218 views

JSONAPI : Patch node path alias [closed]

I have content on a Drupal site and I want to patch to change their path alias. Here is how I do. It is giving me a 400 error: Syntax Error. I don't see where the syntax is bad. I am using Python 3 ...
El Inoubio's user avatar
0 votes
0 answers
132 views

I'm writing a node migration module but only the title gets migrated

How can I get the body migrated as well? When I compared this with other working migrations, there didn't seem to be any differences in the code/anything wrong with mine. I also looked for alternative ...
Karolina Lencina's user avatar
0 votes
0 answers
46 views

Node coloring by taxonomy

My site has a node and a "tags" taxonomy that contain the color field. One node can have multiple tags, but I need to select one main tag. The color from the main tag must be passed to the ...
pofk999's user avatar
3 votes
1 answer
755 views

Why does Programmatic Node Unpublish not Work?

We recently upgraded to Drupal 9.3.0 using a Composer file layout. The resulting website is working correctly and is now running in the publish domain. We have a set of utilities that we run as ...
Greg Sims's user avatar
  • 573
1 vote
1 answer
60 views

Error when trying to view revisions

Using Drupal 8/9. When trying to view previous revisions I am getting the following error: Error: Call to a member function getType() on string in clc_d8_theme_theme_suggestions_page_alter() (line 13 ...
tanbog's user avatar
  • 1,243
1 vote
2 answers
318 views

How to apply nofollow and target_blank on external links in text created with CKEditor?

When I create a node, I often need to add links to external websites in the text. I want all the external links to open in a new tab and I want them to have a nofollow. The body field uses CKEditor. ...
zoulou66's user avatar
0 votes
2 answers
45 views

How do I move a node's tags to be near its author information in my Bartik subtheme

I want to style a node's author data and tags slightly differently to the Bartik theme in Drupal 9.3. That is, rather than: Submitted by user1 on Mon, 1/1/70 Tags foo bar I'd like to have: ...
dave's user avatar
  • 155
0 votes
0 answers
27 views

grant access to reorder in admin

I have a Drupal with some kind of users (admin, gestion etc.) only admin can reorder field with multiple values when I editing nodes. Other user can't, the draggable picture not showed. Have you any ...
raubert's user avatar
0 votes
0 answers
46 views

Image fields that vary by theme

We are building a website that has multiple themes that can be applied to it, based on user selection. The page content type is made up of Paragraphs (from the paragraph module), each of which can ...
Geat's user avatar
  • 463
0 votes
1 answer
36 views

Page Manager fails when accessing structure pages

When I go to Admin/Structure/Pages, the following error occurs: InvalidArgumentException: The internal path component 'https://dssm.vegas/civicrm/contribute/transact' is external. You are not allowed ...
Marc Prince's user avatar
3 votes
0 answers
127 views

How to filter book pages by book with Views? ( how to integrate book with views)

At the moment on Drupal 9.3 there is very poor integration between views and Book Module. how to create a view to show all the book pages with functionality to filter ( an exposed filter) them by ...
Yuseferi's user avatar
  • 21.8k
0 votes
1 answer
116 views

Content type field to include both media entities and links

I'm new to Drupal and I'm creating a new content type. I know there's two separate fields for media and links, but is there a field that include both? For example, the field is called "News ...
wolves11's user avatar
3 votes
1 answer
328 views

What methods are available to resolve "The node.field_name field needs to be updated."?

When Drupal status report says field “field_name” needs to be updated I found out that it sometime hard to resolve. In the past we used to have entup but that was removed. The following works in many ...
awm's user avatar
  • 2,429
5 votes
1 answer
193 views

How does the Geolocation content of a page filter is a Views block?

I have a website with Drupal 9 and the Geolocation module : https://www.drupal.org/project/geolocation I created a content type with a Geolocation field that contains coordinates. My website uses the ...
zoulou66's user avatar
0 votes
1 answer
88 views

Node form ajax dependent dropdown fields issue

I am using Drupal 9. I know how to change single dropdown list using another one. Here is my scenario: I have three dropdowns, in node form - company, protocol and investigator. What I like to do, ...
Md. Shafiq Hossain's user avatar
0 votes
0 answers
97 views

How to check the external links in the nodes?

I use on my Drupal 9 site, affiliate links for different products and services. These links will appear in my nodes. The problem is that sometimes the provider changes its content, so sometimes the ...
zoulou66's user avatar
1 vote
1 answer
524 views

Programmatically loading and saving nodes is not updating my field but editing and saving manually does. Why the difference?

I have migrated D7 date fields to D9 Smart Date (with recurring). During the migration, I've parsed the legacy repeat rules and populated them into the new D9 Smart Date field. However, the repeating ...
quantumized's user avatar
  • 1,177
2 votes
1 answer
416 views

How do I pass a node field value as view argument to another entity reference field?

The issue seems simple, but I can't get any documentation for it. I have a content type with two drop-down fields: field_company which lists taxonomy terms and field_protocol which is referencing a ...
Md. Shafiq Hossain's user avatar
3 votes
1 answer
37 views

Derive all image styles when user uploading

I have several image styles defined but only thumbnail and medium styles(images) can be derived from the original image. I know those two styles are set in the "manage field" of image and my ...
Bing's user avatar
  • 31
0 votes
1 answer
153 views

How do I display nodes in a map block and in the page content, with shared filters?

I am using the Olivero theme on my Drupal 9 site and building a map with the Geolocation module. I want to create a Views to display these two displays of the same nodes : one display which is a map (...
zoulou66's user avatar