Questions tagged [nodes]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
434 views

What is the correct way to send a node list to the REST API?

In Drupal, we can create nodes with the core module "RESTful Web Services". There is a lot of documentation about creating one node with one request, the Drupal documentation provides the following ...
-1
votes
1answer
50 views

Subdomain for each node from content type

Is there any way to automatically create subdomain for each node from some content type? I have a lot of pages that should be created and each should be on separated subdomain, I'm trying to find the ...
2
votes
3answers
81 views

How can I remove old articles?

I have a Drupal 7 database that stores articles since 2013. The database is too big and I want to drop all the old articles to keep only the ones created on 2019, just for development purpose. I read ...
0
votes
0answers
18 views

How to stop Script Injection in field collection

I have created Field Collection with Text and image. Now if i insert java script like <script type="text/javascript" >alert("hacked")</script> How to skip this same i did for node ...
1
vote
1answer
51 views

Cannot get value of Node object

I'm trying to retrieve a value from a Node object. It looks like the value is there, when debugging and checking out the object. But somehow it cannot be accessed. Trying to get the field: // $this-&...
0
votes
1answer
26 views

Language pages are triplicated

Our website was developed with Drupal and we only have a small set of Spanish language pages on a primarily English website. My question is, I'm getting THREE pages generated for every one page: ....
0
votes
0answers
22 views

Change default value on core node/add forms after submit

I'm using the core node/add/ url to create content in my site. I have a date field that defaults to now. I'm also using the add another module. Is it possible to change the default value to the last ...
0
votes
0answers
36 views

New workflow can't select content type

I'm trying to create a new workflow in Drupal. When I click "Content Types" beneath the "This workflow applies to:" section, it loads an empty modal. I have 6 content types but they fail to show. ...
0
votes
1answer
684 views

How to get view name and display ID in template_preprocess_node function

I'm having some trouble in order to get a view's name and the display ID in a template_preprocess_node function. I have a custom content type and a view with two different displays. My idea is to ...
1
vote
0answers
34 views

Verify node content programmatically

I have two types of content: Content A and Content B. Content B has an entity reference field that points to Content A. My problem is that I am trying to check by code if Content B has a defined ...
2
votes
1answer
42 views

Unexpected error when trying to view revisions

A website I maintain can't view revisions without receiving an unexpected error. The log file points to this code in the .theme file but I have no idea what it does. When I commented it out, the ...
-3
votes
1answer
49 views

Text will not vertical-align to the top in Drupal table [closed]

I am trying to edit a table in my Drupal editor that has images on one row (4 td elements) and a second row with text (also 4 td elements). I have applied vertical-align:top to the cells in the text ...
0
votes
0answers
43 views

Creating a node works on local but not on production

I'm using the same version of Drupal 8 on both local and production. I'm trying to create a node using the Drupal 8 core REST api. My curl looks like: curl -i -X POST \ -H "X-CSRF-Token:mytoken" \...
6
votes
1answer
474 views

How to implement custom access to node revisions?

I want to implement a custom access check in Drupal 8, where users assigned to the node field node-owner have view/edit and revisions view/edit permissions for this specific node. I have implemented ...
2
votes
1answer
126 views

How can I process a node form from a custom submit handler?

I have a use case where I have a custom submit button on a node edit form that will take the user off to another page to do some other editing. If the user has made some changes to the node, such as ...
4
votes
2answers
455 views

Node Load performance

I have a small question. If I use Node::Load on the route of the same node for example: I go to site.com/node/125 and in preprocess I use Node::Load(125), would Drupal load that node all over again? ...
0
votes
1answer
27 views

Display the exclude dates on a node

I have a Drupal 7 site with a content type called Weekly Repeating Event, and events of this type repeat at the same time and day each week. I use a custom template file to display this node type by ...
0
votes
0answers
17 views

Convert content types to forum topic types and view in the forum tables

I want to migrate a site from Drupal 7 to Drupal 8. All right, perfect import. However, on the Drupal 7 site I populated some forums through RSS using the Feeds module. But the transfer from Drupal 7 ...
0
votes
1answer
124 views

How do I get the field definition of a paragraphs image field

I need to get the resolution of the image using getFieldDefinitions(). For normal fields I can get the field definitions with below. $fieldDefinition = \Drupal::entityManager()->...
0
votes
1answer
27 views

Save content with current user roles and add filter to show only content with current user role

Using drupal 7, when creating new content of the type "Document" the current user roles must be added so I can later on show only Documents of his current role. For example, we have the following ...
0
votes
2answers
68 views

What's the best infrastructure to set permissions to user roles that controls who can see which Nodes and which Views? [closed]

I'm building a bsite that needs pretty stringent permissions. I have already created the (4) user roles for the site, but not sure the best way to handle viewing permissions. I see that when creating ...
0
votes
1answer
321 views

Migrate content from drupal8 to drupal8 programmatically with Node::load and Node::create

Basicly I want to migrate content from one drupal8 instance to another. they are mostly identical with some small changes. first step is to migrate the content type via drush gen module module and ...
0
votes
1answer
20 views

Navigation for book collections

I'm working in a projet where I have to show a collection of books. In this website I managed using the books navigation block, for one collection with many books, with css I managed to set a tree ...
0
votes
1answer
406 views

How to append options and classes into a custom attribute in Twig?

In our twig template we have a need to wrap certain fields with a Link field. In the existing twig template there already exist an attributes variable (accessed by adding attributes), but we have a ...
1
vote
1answer
30 views

Add another button removes the default values from my fields on node form

I have a node form on which two fields are displaying. One is a list of radio buttons which is required field. I am getting a value from url using arg(3) and setting the default value of that field $...
0
votes
1answer
866 views

How to access/arrange the {{ content }} field within a Drupal 8 template?

I am relatively new to Drupal and have just successfully (thanks to help from this community) pulled out a field value and used it to display a custom icon on the page. Coming from a HTML/CSS only ...
-1
votes
1answer
28 views

How to migrate one type of contents to other type having same fields? [closed]

I have 2 content types having same fields and I have many contents added by cleint in both the types,now I want to change some of the node's type A other type.. How can i achieve this?
-1
votes
1answer
51 views

Prevent delete content before it is removed in external index

This is my use case. We have a Drupal 8 installation that we used as decoupled, so one external API retrieve all content and them indexed. So, this external API update indexed content when Changed ...
0
votes
1answer
34 views

How can I change the value of a field in node / [id] / edit?

I should change the value of a field before it is rendered. I tried with [NAME_MODULE]_node_view but it is not invoked when I edit the node. Thank you so much.
0
votes
1answer
335 views

Show child pages in parent node view details in a book

I'm using the Book module to maintain the parent-child relationship between content. I want to see all child pages expanded when I see a parent node details page. How can I achieve it? I tried with ...
0
votes
0answers
38 views

reset existing content type settings to default settings

In my Drupal 7 Site, I have a couple of Nodes of the same content type. On some of them, the settings( Menu, Sitemap) have been changed. How can I reset all of them to the default settings for that ...
0
votes
1answer
120 views

How to create custom view/display for few content_types?

EDIT: see two paragraphs below to what I managed to get I can't find a way to use single template for few but not all content_types. Let's say I have content_types A, B, C and D. I want to use ...
0
votes
1answer
296 views

Call to a member function label() on null after saving a node with a taxonomy term

I create nodes, which have a taxonomy field, like this: $node = Node::create([ 'type' => 'article', 'status' => 1, 'title' => 'Some title', ... 'field_taxonomy' => [1, 2, 3], ]);...
0
votes
1answer
133 views

How display node author roles at node.html.twig

My user case is: Extlink module can add exception classes to avoid processing some links. I want some external url links on nodes whom author belongs to a special role (premium) can be mark with a ...
0
votes
2answers
158 views

How do you set a node reference field's default value when creating a node programatically?

I use this: $values = array( 'type' => 'competition', 'title‎' => 'my title goes here', ); $node = \Drupal::entityTypeManager() ->getStorage('node') ->create($values); This works ...
0
votes
2answers
112 views

Get taxonomy terms added to nodes

I am trying to get all the taxonomy terms added to a node. How would I get only the taxonomy term values that are added to a code in a mymodule_preprocess_node hook? Current term list: value1 (tid=1)...
0
votes
1answer
52 views

Not able to export nodes from one drupal site to other drupal site?

I have 2 instances of same drupal project, where contents are different. I want to export contents from one drupal site to other drupal site. I tried content syn module: I Was not able import ...
-1
votes
1answer
203 views

How do I add an existing paragraph field to another content type programmatically

I have a paragraph field that is already used in a content type. I need to add that paragraph field to another content type using the same field that I was using in the previous content type. How do I ...
0
votes
1answer
61 views

What is the basic concept behind revisons in term of performance? [closed]

On a Drupal 8 project, I am planning to allow revisions to be created for one "content type" which consist of around 40 different fields ! Can someone explain the concept behind on how Drupal save ...
1
vote
1answer
178 views

Get form values into hook_node_insert / hook_node_update

I need to get in hook_node_insert and hook_node_update the value of a field I manually added to a form. function hook_form_FORMID_alter(&$form, FormStateInterface $formState, $form_id) { $...
-2
votes
1answer
45 views

Memory exhausted during csv upload? [closed]

I am uploading a csv and creating custom nodes. I have set the drupal memory limit to 512M and I can see this in the drupal status report. But when I am uploading a csv file, I am getting the error ...
1
vote
1answer
547 views

Set entity reference revision field value?

How do I set entity reference revision value for a field? I have two fields, field_test_entity_reference and field_test_entity_revision. field_test_entity_reference is of field type entity reference ...
-2
votes
2answers
39 views

Are all my nodes publicly available at their respective links (ie example.com/node/25)?

I'm new to Drupal and working on a pre-built Drupal site. There seems to be a large number of pages that are public with the /node domain path. For example, something like the link example.com/node/10,...
0
votes
0answers
51 views

Redirect after saving referenced nodes

[Note, this question is almost identical to this one for Drupal 7, but since I never used it I cannot understand how the proposed solution can be ported to Drupal 8] I have a parent node type, let's ...
1
vote
1answer
75 views

Date/Time +1h in Node

I have a module to import nodes with a date/time field. All times are correctly written into the database. But when I view a node or in node/edit I get the time +1 h. In Drupal I have set the timezone ...
2
votes
0answers
107 views

Working with hook_node_access_grants

I am currently working with Permission by Term to set simple access control on two node types with terms. As noted here, I believe I found a bug where the access record isn't written the first time ...
0
votes
1answer
214 views

How to add title of the image in manage display section or display it in node view page

I want to display title property of an image in node view page. How can I display title of an image along with image in node page?
0
votes
1answer
35 views

How to get field value after getting a node?

I have a content type which contains school information. School name and school id are two fields in the content type. I have the school ID and I am able to retrieve the node. How do I get the school ...
0
votes
2answers
79 views

how it's possible to load nodes by taxonomy terms

Here im loading nodes by "type" article, i want to call nodes by another id , but this id is in another table, should i join tables , or it is some other way to do this $type = "article"; $...
0
votes
1answer
45 views

How to pre-populate paragraphs when creating a page [duplicate]

I have tried for some time to find out a way to populate a new page with a few paragraphs to save time on most of the pages (but which might change position or even get dropped for some pages) but so ...