Questions tagged [nodes]

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

Filter by
Sorted by
Tagged with
-2 votes
0 answers
37 views

How do I programmatically update a node path? [closed]

How do I create a custom module to update an existing node's path alias?
user111272's user avatar
0 votes
1 answer
63 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
  • 27
0 votes
0 answers
29 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
-3 votes
0 answers
26 views

Cannot add content after uninstall of DXPR module - this is the error

The website encountered an unexpected error. Please try again later. TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, class "Drupal\dxpr_builder\Entity\Node" ...
kalalshehri's user avatar
-2 votes
0 answers
31 views

Group fields based content form in Drupal 10

I have a task to add data based on the following details. I'm using Drupal 10 for the developments. Here I have to create a content type that has the option to enter the information as groups. In ...
harikris's user avatar
  • 349
1 vote
0 answers
8 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
66 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
55 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
18 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
12 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
34 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
32 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
29 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
63 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
36 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
0 votes
1 answer
331 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
0 answers
58 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
24 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
23 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
57 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
57 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
44 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
86 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,399
2 votes
3 answers
106 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
62 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
25 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
1 vote
1 answer
124 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
  • 184
0 votes
1 answer
84 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
90 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
201 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
117 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
57 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
0 votes
1 answer
64 views

Statistics counter based on user role

I need to track some basic usage statistics for a subset of my authenticated user roles in Drupal 9. Is there a way to make the core statistics counter only count node views based on user roles? The ...
tanbog's user avatar
  • 1,243
-1 votes
1 answer
56 views

How to remove author field from the 'advanced' field group on the node edit form

I've got several node edit forms that, in most themes, display the 'advanced' group in a sidebar. I have other plans for the sidebar, though, so I don't want that behavior. I edited some twig and css ...
aharown07's user avatar
  • 353
0 votes
0 answers
13 views

eCommerce Products Permissions per Node

Good day We are building an eCommerce Platform where multiple users can be able to register, login, create, edit and delete their Profiles and Products. The main feature is to have each user to only ...
Thomas Tsita's user avatar
0 votes
0 answers
32 views

Headless and custom node / entity access

I struggle to set up custom access rules for "nodes" that are viewed via the jsonApi entityQueries which response via json endpoint What I try to achieve: I need to skip a node, that ...
mogio's user avatar
  • 687
0 votes
1 answer
96 views

Run custom php code or file in drupal content type form submission

I have this drupal site, there is a candidate registration page where anyone can fill the details (name, gender, address, mobile no etc) and submits and a success node page is displayed with all ...
user3099225's user avatar
-2 votes
2 answers
274 views

get node id from entityQuery('node') [closed]

I want to get the node id from entityQuery('node') the below query give me array vid = nid $nids = \Drupal::entityQuery('node') ->condition('status', 1) ->condition('type', 'account_content') -&...
New Dev's user avatar
0 votes
0 answers
19 views

Taxonomy field not displaying in a Node built with Paragraphs

I have a node type called Profile. It includes a paragraph type called Person. The fields in that paragraph type are: Name (text) City (taxonomy field) Brief (text). Whenever I look at a published ...
tsitsi's user avatar
  • 1
0 votes
2 answers
168 views

How show field labels in the node display even if it's empty

While showing a node, only the filled fields are rendered. I wanted to be able to show the empty field labels, and I was looking for something like the ability to uncheck an option such as 'Hide if ...
rfmarcelino's user avatar
1 vote
0 answers
25 views

How can I find all the nodes that use a hierarchical vocabulary taxonomy term and reference a child term but not its parent term

I am using Drupal 7. I have a content type "Public Resource" that uses a hierarchical vocabulary called "Resource Topics" that has up to 3 levels (parent->child->child of ...
Matt Pugh's user avatar
0 votes
0 answers
23 views

How to access block contents in run within hook_form_alter? [duplicate]

I am using Drupal 9 and I need to get the block content within hook_form_alter implementation, I tried these lines: $bid = 'consumerorganizationselection'; $block = \Drupal::entityTypeManager()->...
Ahmed Ashraf's user avatar
1 vote
0 answers
59 views

Node edit form - Is it possible to load entity reference field data on click after the form has finished loading?

I have a custom node type (let's call it Project) with many fields. Three of these fields are of an Entity reference type, referencing other related nodes (let's call them Project Attachments A, B, ...
S.Gou's user avatar
  • 11
1 vote
2 answers
486 views

How can I get a rendered node field value with filters applied?

I'm trying to use a REST resource that accepts a node title and returns a JSON interpretation of a single field. This requires raw HTML that I can then use in DOMDocument. To get the rendered value of ...
blu's user avatar
  • 438
0 votes
1 answer
61 views

Unable to add custom css from asset injector module to content type

I have a content type called Advertisement on my Drupal site. I want to add some custom css functionality to this content type (as in, when I create an advertisement from the "Add Content" ...
Diamoniner12345's user avatar
0 votes
1 answer
55 views

Empty node references on node creation and on node load

I never noticed it, but: If I create a node containing a reference and set the reference field to null, the field is still set as an EntityReferenceFieldItemList, e.g. the following code echo "...
Francesco Marchetti-Stasi's user avatar
0 votes
1 answer
35 views

Unsuccessfully trying to get to the correct target_id

So I've been programming a module that needs to show different pictures depending on the language code of the user (en vs. fa). For that I'm trying to get to the right target_ids. Debug($nodes) shows ...
Quetzcodecoatl's user avatar
1 vote
1 answer
122 views

How to obtain a node id and product type from the product variation id?

I have a view in Drupal that has a field called Index product variation search: Item ID. Its description is "the item's internal (search API specific) ID". Here is an example of what this ...
Diamoniner12345's user avatar

1
2 3 4 5
151