Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [nodes]

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

0
votes
0answers
18 views

Image alt tag not saving on save/edit

I have a content type for gallery photos which has a Image data type. When I create the content type Drupal ignores the alternate text I enter for any uploaded image. When I edit the content type ...
0
votes
0answers
15 views

Revisions counter in node overview

I would like to see how many revisions a node has in the node overview page (/admin/content). The ones that are listed in e.g. .../node/ID/revisions It can't find anything like delta revisions or has ...
0
votes
0answers
13 views

List of food items on a node that can be rated and shown in order of their rating

I'm looking to have a list of fields on a node, each field is a food item and this list of food items are sorted by their rating/vote from the public. How is this possible? I'm thinking paragraphs ...
0
votes
2answers
27 views

How to render author custom fields info on comment and node twig template?

I am trying to render the author Full Name and other authors customs fields information in comment.html.twig and node.html.twig. But not any of the fields that I made for users such as "First Name", "...
0
votes
2answers
32 views

Get node's view mode within template_preprocess_page

We have to get the current node's view_mode from within the mymodule_preprocess_page(&$variables) hook. When we tried the following we could not get the view_mode after performing some validation ...
0
votes
0answers
43 views

Programmatically set a $form_state value for user reference

I'm trying to programmatically create nodes through form submit in Drupal 8 (because I need to validate the submitted values) in this way. try { $node = \Drupal::entityTypeManager() ->...
0
votes
1answer
12 views

How to print author's email address in in node template

I have a content of type summary only visible by the author and administrators. I need to print in my node--summary.tpl.php the author's email address that was set at the account creation. Any idea ...
0
votes
0answers
59 views

How to optimize select option Book outline of Book module

I'm using module Book of Drupal. It's so great. But I have a lot of books about 3000 books. When I create chapters for books that choose books very difficult because select option very large and ...
1
vote
2answers
58 views

How do I give access permission for specific node to anonymous User

I have removed "Access Content " Permission from Anonymous user. Now want to display specific node to the anonymous user. As this is for only 1 or 2 nodes, It's not a good idea to use a contributed ...
1
vote
1answer
35 views

How to create a “Make this Sticky” link or tab

I need faster way to promote a node I'm looking at. I usually go for: "Open node view page" (IE: https://example.com/node/123) "Click Edit" (IE: https://example.com/node/123/edit) Scroll down ...
0
votes
1answer
15 views

Relate Content to a Group feature when creating a node outside a group

In my drupal site, I'm using the Group module. My problem: I created a regular Drupal node type, let's call it userpost I created a group type called "usergroup" The content type "userpost" is ...
0
votes
1answer
33 views

Cancelling user account set draft pages to published

When we cancelled a user account using the Delete the account and make its content belong to the Anonymous user method, we found that the author was set to Anonymous for the pages they were set as the ...
-1
votes
1answer
22 views

Show content type teaser only if posts available for the content type

I'm displaying a content type teaser view on the front page using Twig Tweak. But I want to show it only if there are posts available. Something like {% if content type has posts %} <h1>...
1
vote
0answers
32 views

How do I cache web page for different header parameters?

I use AWS cloudfront with my drupal site. It sends below value with response headers. CloudFront-Is-Mobile-Viewer => true This value is true when you view your site with a mobile. And if this is ...
0
votes
0answers
21 views

How do you add a field to a node type form?

I would like to add a boolean field to all node type forms and save it's value in config. I found this tutorial, but the code formatting is really bad. http://www.jaypan.com/tutorial/drupal-8-...
0
votes
0answers
49 views

Drupal not generate image style for .png

On node edition when i upload new image, like in basic page, all is working with .jpg and .jpeg picture but not with .png. When i upload a new image, the style is well created in 'sites/default/...
1
vote
1answer
33 views

Modify article body for one particular article to add data

How do I modify an article's body field before the end user sees it for one particular article? Background: Currently the content editors are updating this data manually twice per week. We want to ...
0
votes
1answer
30 views

How do I add a customized parameter to image links

Lets say I have image fields in my node. When I get that fields values in the twig it returns the image URL without any issue. file_url(node.field_image.entity.uri.value) But now I want to add a ...
0
votes
1answer
28 views

How to show in a view the total number of paragraphs for a node?

I have a content type with a field of type paragraphs, with possible unlimited values. I need to show the total number of paragraphs for every node, in a column, in a views (table of fields). It seems ...
1
vote
1answer
36 views

How do I show a list of nodes referenced by a field?

I created two content types: News Agency and News. The News content type has the Headline, Title, Body, and News agency name (a reference to a News Agency node) fields. The News agency content type ...
0
votes
0answers
10 views

Removing images from node gives Cannot be modified error

I am using the latest drupal 7 version 7.64 and using multi plupload module for uploading images with drupal's bundled image field. The problem occurs when I try to remove an image then try to save, ...
-1
votes
0answers
12 views

Drupaul Webform node to text node

I need to change the right hand side lead capture part of a webform to text. The problem I'm having is when I turn this into text, it's replicating the left hand side text exactly. I need these to be ...
0
votes
0answers
22 views

Duplicated node pages are created with other language prefixes. How to fix it?

The content on our website is primarily created in English, however, we also have 3 other languages (fr, de, es) implemented. But not all the content is translated. The problem is - in Google, we see ...
2
votes
0answers
42 views

How do I programmatically change the node default language?

I have a node already translated in 3 languages (en, fr, es) with en being the default language. and I want to change it to fr. I looked around and I found setDefaultLangcode() (protected). Is there ...
1
vote
1answer
134 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
35 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
54 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
47 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
23 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
30 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
86 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
28 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
35 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
29 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
24 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
93 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
30 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
423 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
17 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
13 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
39 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
0answers
19 views

Use colorbox node from a jquery command on a basic page?

I'm trying to open up a node via the Drupal 7 Colorbox Node module on a basic page using jQuery and hooks from a map. I can get colorbox to put up a HTML pop-up using this code: <script type="...
0
votes
1answer
19 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 ...
1
vote
2answers
48 views

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

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
28 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 ...
1
vote
1answer
15 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
41 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
25 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 $...