Questions tagged [nodes]

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

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

Nodes for sidebar menu

I'm hoping someone can help me figure how I deleted a sidebar menu on one of my pages. Does anyone know how to get it back or recreate a sidebar menu ?
1
vote
1answer
71 views

Remove library from page based on node field value

We have a content type, Basic Page, where we may want to include 3rd party CSS such as Bootstrap. However, this 3rd party CSS may conflict with our custom theme, mytheme. On the Basic Page, we added a ...
0
votes
1answer
45 views

How to use custom code to change the node form layout and group fields while maintaining values?

I am trying to alter the node form layout in a form alter hook. I altered the node form and added a field set in which I grouped couple of existing fields into a fieldset. Then hid the existing ...
1
vote
1answer
53 views

Custom edit Panel/Tab for content type

In Drupal 8 I have a custom content type, and I want to add a group of fields to it that are related to tracking. Since these fields don't have to do with the content displayed, I wanted to separate ...
0
votes
1answer
75 views

Render taxonomy type custom fields individually

I'm kind of a twig newbie so I'm hoping that someone can point me in the right direction. I've added a custom field field_url to a taxonomy type called field_type_poi. How would you render that ...
0
votes
0answers
21 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
22 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
680 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", "...
1
vote
2answers
191 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
718 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
18 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
65 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
292 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
51 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
33 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
42 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
27 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
44 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
29 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
61 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
41 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
33 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
103 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
42 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, ...
0
votes
0answers
37 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
273 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
392 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
49 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
78 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
34 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
612 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
33 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
40 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
45 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
41 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
425 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
118 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
453 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
26 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
112 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
59 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
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
64 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 ...