Questions tagged [nodes]

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

Filter by
Sorted by
Tagged with
2 votes
1 answer
26 views

Where could I see a table of the most viewed nodes?

In Drupal 10.2.4 with Statistics core module installed and node view count activated, I want to see a table of the most viewed nodes like this: node 1 | alias (if any) | 601 views node 8 | alias (if ...
aji's user avatar
  • 21
0 votes
1 answer
34 views

How can I generate multiple pages, each with a unique URL based off of 1 template?

I have a very specific need for Drupal, but not sure if there is a solution and was hoping someone might know of a module or method that might get me going in the right direction? My brother is a ...
Nick's user avatar
  • 1
0 votes
1 answer
56 views

Which is the correct way to create redirects from existing nodes

I was discussing with a friend who usually makes different redirects on his site. Having an existing and published Node he creates a new Node of the same Content Type and creates a redirect from the ...
Adrian Cid Almaguer's user avatar
0 votes
0 answers
26 views

Use the Node Export module to export nodes with images

My team and I want to use the Node Export Module to export and import nodes that include image fields between environments of our Drupal 10 site. However, when I export nodes, the image fields only ...
Amy's user avatar
  • 21
-2 votes
1 answer
53 views

Can I put taxonomy tags in a block and if I can, how to prevent them from appearing in a field of a node?

Having the taxonomy tags in a field of a node in the main content block of the Content region, is a problem for me, as I would prefer having them inside a block so to better choose where they appear. ...
heya's user avatar
  • 1
0 votes
0 answers
14 views

Theme Drupal comment reply page exactly like comment submitted page

I have created a custom content type 'article' where a custom comment field has been added along with other fields like images, taxonomy terms, etc. In the theme file (page.html.twig) for this content ...
shinkula's user avatar
1 vote
0 answers
64 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
  • 939
0 votes
1 answer
55 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
  • 939
0 votes
0 answers
18 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
92 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
55 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
  • 41
-1 votes
1 answer
65 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
  • 41
0 votes
1 answer
92 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
  • 41
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
50 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
49 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
60 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
58 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
26 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
  • 412
0 votes
0 answers
58 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
38 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
36 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
135 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
120 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
74 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
144 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
22 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
18 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
  • 21
0 votes
0 answers
73 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
41 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
51 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
2 votes
1 answer
225 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
  • 21
1 vote
1 answer
55 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
2k 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
255 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
35 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
  • 285
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
64 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
154 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
217 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
273 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
300 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
99 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
492 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
  • 196

1
2 3 4 5
152