Questions tagged [nodes]

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

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

Is possible to get the latest default revision of a translatable node?

I'm on D10. The site has a content type, e.g. article, which is translatable and has a standard content moderation workflow (draft, published, archived). Given a node of that bundle, I need to find ...
Giuseppe's user avatar
  • 907
0 votes
1 answer
40 views

How get the default language of a translatable node bundle?

I'm on D10. I have a translatable content type, e.g. node, article bundle. How can I get programmatically its default language code, defined in the settings form? I've tried $entity_type_manager = \...
Giuseppe's user avatar
  • 907
-1 votes
0 answers
37 views

How to have a field image display a dynamic default?

This question can be subdivided in 2 linked problems : display an image field in a node despite being empty. if it's empty, display an image dynamically decided by the context (domain, taxonomy of ...
Thony's user avatar
  • 371
0 votes
0 answers
15 views

Displaying content in draft mode

A view is set up to display a node's contents. The node contains workflow moderation, like the published status. To make a new change in the content and to preview it, the content is set to draft mode....
jojan's user avatar
  • 1
-2 votes
1 answer
58 views

How can I avoid a node is crawled and indexed by search engines in the tightest way possible? [closed]

I have a node whose path alias is /example, where I test JavaScript and often share it with fellow JavaScript programmers to consult about how best to do something. I often need to post the URL for ...
drupaler's user avatar
0 votes
0 answers
34 views

Force new revision when updating a node programatically [duplicate]

In a project, there exist about 30K nodes which some data should be changed and new value replace the old one, the code is simple like below: $question = Node::load($id); $question->field_is_normal-...
Alireza Tabatabaeian's user avatar
0 votes
1 answer
53 views

How can I get a printable version of a node?

I have a node with a simple article in it (an <H1>, a bit of <H2>s and some <p>s). If I print this page from the web browser as-is, I will get it with grandiose spacings, Drupal ...
alesios's user avatar
-1 votes
1 answer
62 views

Give all users including anonymous ones the option to add nodes of certain content types to a list like "interested", at least once

I'd like to give all users including anonymous ones the option to add nodes of certain content types to a list like "interested", at least once. The logic is identical to that of a shopping ...
alesios's user avatar
0 votes
1 answer
90 views

How to let users write private letters to me about a node?

I want to let users the ability to write personal letters to me based on nodes they read while letters are stored in the Drupal database itself (no emails involved) and will include these fields: ...
alesios's user avatar
0 votes
0 answers
28 views

Get current node url in a custom block [duplicate]

I'm trying to embed Discourse comments in Drupal, so I'm tryinig tu use this code snippet in a custom block : <div id='discourse-comments'></div> <meta name='discourse-username' content=...
Vanessa Lambert's user avatar
0 votes
1 answer
34 views

How do I link to a custom form mode in a (node) tab?

My issue is my form is too big and too slow, with nested paragraphs, media entities and so on, the biggest issue is the metatag-module with its 100s of fields. So I thought I just add a new form ...
Stephan Steege's user avatar
1 vote
0 answers
38 views

Why is "'access content' permission is required" when accessing nodes with _format=json?

After upgrading to D10, authenticated users cannot access /node/{id} rest endpoint and images. View published content permission is enabled and I can see in the logs that I am authenticated. Clearing ...
Abdul Sadik Yalcin's user avatar
1 vote
0 answers
58 views

Modifying a field value in theme_preprocess_node()

I have a content type (exercises) which contains a text field (field_path). In this text field I have a path to a video file. I would like to retrieve the value of this field in theme_preprocess_node ...
HEIA Drupal's user avatar
0 votes
0 answers
28 views

Can't save node when fields are altered with entity_bundle_field_info

I have a node called Program, with a large number of fields and a custom node form. Because of the very complex way we're indexing it for search, I have two fields, award_type and award_goal, which ...
tinkerer_and_putterer's user avatar
0 votes
0 answers
57 views

Title length error

We just started receiving the following error when attempting to add a new content item: "Title cannot be longer than 70 characters but is currently 79 characters long." This happens ...
CJ Catalano's user avatar
0 votes
1 answer
23 views

Promotion options not visible to Editor role

I have a "Editor" Role with limited access rights. It can basically only create blog type nodes. I'd like to expose to them the possibility to make to publish the node to the frontpage via ...
Andreas's user avatar
  • 392
0 votes
0 answers
56 views

View breaks the page output

Has anyone encountered this problem or can at least help me debug it? The views is displayed as standard if the parameters are specified. Format:Unformatted list | Settings Show:Field If I change it ...
drupnub's user avatar
0 votes
1 answer
32 views

How do I sort view results by query order?

In my twig I use {{ drupal_view('slider', 'block_1', '74,84,82' ) }}, how can I make sure the output of this view has the slides in that specific order? Currently on D9. I've looked around but can't ...
Lenny's user avatar
  • 214
0 votes
0 answers
35 views

Deny access to pages or nodes base from a database table

I was modifying a 2fa module for restricting users to access other account's page (user/%/2fa) which is working. function custom_2fa_menu() { $items['user/%/2fa'] = [ 'title' => t('...
DevNooby's user avatar
0 votes
1 answer
111 views

How to have a different hero image per node?

What we want: Users should be able to choose an image, add call to action links, and a few other options when setting up a hero for the specific page they are creating. We have three different content ...
Jordan's user avatar
  • 49
0 votes
0 answers
87 views

How can I programmatically get the node title? [duplicate]

A drupal newbie here. I'm looking to build an "issues navigator", a custom block displaying a menu. I'd like to set the "current issue" automatically, from the title of the node ...
Victor Pudeyev's user avatar
1 vote
0 answers
11 views

How can I add the hero section image in the View to REST_API?

Hello im using Drupal 9.5.9 version. How can I add the hero section image in the View to REST_API? I have created an api with Rest_API to fetch data from Views I have created. I have no problem ...
devr4n's user avatar
  • 11
2 votes
1 answer
72 views

Is it logical to give a homepage an alias? [closed]

Drupal allows us to give a URL alias to any node (example.com/my-alias). The "Home page" node is not an exception. Is it logical to give a homepage an alias? Shouldn't we just keep it "/...
alhemist's user avatar
-3 votes
2 answers
133 views

How can I embed PHP code in HTML?

I want to execute few curl commands from my Drupal site using PHP. Idea is to create a custom content type that accepts php code. I understood from the internet I have to create a file "node--...
Reddy Rohit's user avatar
0 votes
0 answers
21 views

MSSQL - How to get a list of documents from a node that is using a space and a view?

I have a list of documents that are associated with a node of type space. The space has a page with a view and filter to list documents only related to that node. I'm trying to query the database to ...
Charlie Boy's user avatar
0 votes
0 answers
16 views

How to filter webform nodes with a contextual filter that restricts webforms to those which have not been answered

I have a webform node display page that shows webform nodes that are available to individual users. Individual user accounts have a field called Project which has a Project name. This allows users to ...
Santam's user avatar
  • 15
0 votes
0 answers
62 views

How can I search for existing nodes with "Text format" = "undefined"?

I've upgraded to Drupal 10 from an earlier release, which used the PHP module (not yet available for Drupal 10). Therefore, I had to uninstall the PHP module before upgrading, leaving the "Text ...
user42221's user avatar
0 votes
0 answers
38 views

Inline Entity Form - is it possible to add field from child entity's taxonomy reference field

I have the below structure on my Drupal 9 site: Product content type -- field_product_integration (references contents of type Integration) Integration content type -- field_product_feature (...
Ashok Negi's user avatar
0 votes
0 answers
49 views

Populate field value based on external API response

My custom Drupal 10 module takes the value of an address field submitted by the user during node creation, sends that to an external API, and then fills a taxonomy term reference field based on the ...
twhitefrd's user avatar
1 vote
1 answer
173 views

How can I copy a field to another field?

I have an Article content type for which I want to change the machine name of its fields. I created new fields with a different machine name. How do I copy the old fields to the new fields?
steven's user avatar
  • 11
1 vote
1 answer
46 views

How to access the node/term field-values in a cleaner way?

My code is filled with methods like these to access field values: \Drupal::entityTypeManager()->getStorage('node')->get('field_name')->getValue()[0]['value']; \Drupal\taxonomy\Entity\Term::...
seventh_sniper's user avatar
2 votes
1 answer
1k views

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "node_type" plugin does not exist

I have upgraded drupal 9 to drupal 10 and now while creating a content page or editing the existing content page it is throwing error in error logs Drupal\Component\Plugin\Exception\...
Libbna Mathew's user avatar
0 votes
1 answer
193 views

How can I programmatically save node components?

There is a site with number of nodes including layout canvas and site studio components available in a node. When there will be changes in one of the components (new field added with default value), ...
Ankit Hinglajia's user avatar
-2 votes
1 answer
33 views

Is there a way to allow entering a value in a node's field if inserting a new node, but make the field disabled if updating that same node?

I'm using Drupal 7 and I have a standard text field in my Content Type. If the user with role "Standard User" is adding a new node then they should be able to set the Status field text value....
MrSnrub's user avatar
  • 291
1 vote
0 answers
29 views

How to give ability to create custom NID numbers via API REST post when creating content?

I'm using Drupal 9.4 and I tried to pass in a nid value in my POST via the Drupal api. I'm getting the error: Response: {"message":"Access denied on creating field \u0027nid\u0027."...
Patoshi パトシ's user avatar
0 votes
0 answers
61 views

Is it possible to not show extra box by default when Allowed number of values is Unlimited in Text (formatted, long, with summary)?

I have created a long text formatted field with unlimited allowed number of values. But it is giving one extra box as default. Every time user edits the content the empty box will show. That is so ...
Priya Degwekar's user avatar
0 votes
0 answers
20 views

Is it ok to share a comment field with multiple content types?

Imagine I want to convert individual forum threads (topic + comments) into a content type 'Blog post' to preserve them for the long term. In order to make this work, the comment field of 'Blog post' ...
Anders's user avatar
  • 145
0 votes
1 answer
62 views

How can I overwrite the value of a field in a bundle class?

In Drupal 9 I would like to know if it is possible to overwrite the value of a field in a BundleClass. Looking at the Drupal API, I see that it is common to use either hook_entity_view_alter or ...
Oskar Calvo's user avatar
0 votes
2 answers
115 views

How do I programmatically assign a new book when a new node is created?

For a given content type, if a new node is created and no book is assigned, I'd like to create a new book and assign the new node to that book. (some background - that content type is the book cover, ...
commonpike's user avatar
-1 votes
1 answer
159 views

Getting old node field value in update hook

Hi I'm using the node update hook in my custom .module file in my Drupal 9 site. I have a field called field_amount. And I was wondering if I can access the old value of that field within my update ...
user108721's user avatar
0 votes
1 answer
232 views

Prevent last updated property from changing when updating node in code?

I have this code that updates a node in a queue worker: $changed = $entity->getChangedTime(); // Don't update the changed time by $entity->setChangedTime($changed); $...
awm's user avatar
  • 2,459
2 votes
3 answers
220 views

Append new paragraph item to existing node

I want to append a new paragraph item to a existing node, which has previously a paragraph item. I just want to add another paragraph item with the previous one. But my script only updates the ...
Souvik Das's user avatar
0 votes
1 answer
94 views

How to make it so theme function isn't used when editing a node with layout builder

I have the following two functions in my .theme file that I'm using to gleam various bits of information from both the path alias and internal URL of the page being viewed. They are: function ...
fallenturtle's user avatar
0 votes
1 answer
26 views

Unable to update node entity fields using custom form

There is a certain content type, in which there is a field to enter a node or taxonomy. I want to create a new node for that content type using a custom form and register the node or taxonomy in the ...
shibasaki_stack's user avatar
2 votes
1 answer
370 views

How can I set view permissions for content type to make it visible to autenticated users only?

I want a content type to be only visible to authenticated users. Now the edit permission dialog only offers permissions for modification, not for displaying the published content. Until Drupal 9, I've ...
david's user avatar
  • 194
0 votes
1 answer
182 views

Creating a Custom Content Listing Page based on specific content type or taxonomy terms selected in the node

I am trying to create a content type that generates a list of content/nodes based on other content type or taxonomy terms selected within that node in the content type. I have a general content type ...
JohnC95's user avatar
1 vote
2 answers
187 views

When adding new nodes how can I pre-populate the body field with the body of another node?

I have a Drupal 9 website with number of nodes that I use as templates, I clone them to create nodes with the same body text. However, I want to make this process simpler by prepopulating the body ...
Yuri's user avatar
  • 618
0 votes
1 answer
329 views

Field values in node HTML body

I am using Drupal 10 and trying to edit the body of a node. I want to use the node field values in the HTML body, for example [field_name], but this does not appear to work as it only shows that ...
timmyblaze's user avatar
0 votes
1 answer
171 views

Use AJAX On Node Add Form To Change Field Required Status

On a node/add form I have a pair of fields that need to be able to control one another. The first field allows a user to enter a birthdate, the second field allows the user to say the birthdate is ...
Drupal Learner's user avatar
0 votes
0 answers
62 views

How to modify the "href" attribute of some of the links of an html field type?

I'm using drupal 9.4.8 and I have a content type called "articles" which has a "body" field (which is a reference to a paragraph) and I'm making an algorithm to check all the ...
LeJuanChis's user avatar

1
2 3 4 5
151