Questions tagged [nodes]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
187 views

Custom Page routing

I created a custom page type called 'Angular page' and a custom twig template for it which loads my angular scripts and prints the <app-root> tag. I set the page URL to /angularpage and the ...
0
votes
1answer
69 views

REST Export Views and images alternative text

I have a simple REST export View. The View format is set to "Show: Entity". The content type I am exporting contains a standard image field. My image field settings is set to "Enable Alt field" and "...
0
votes
0answers
26 views

How to get referenced entity fields from another content type in single node template [duplicate]

I have a content type called "Resources", this is referenced from another content type called "Projects". I can get simple text fields in my single node--project.html template for example - {{...
0
votes
2answers
371 views

How do I pass a value to a content type field with a custom submit please

and thank you for your patience in helping me learn I have created a content type called response (Through Drupal, not in a custom module) In the content type I have a field called ...
0
votes
0answers
40 views

How to rename a content type programmatically

There are many answers and tutorials addressing the problem of changing the machine name of a content type, or migrating content types. However, I would like to rename a content type, without changing ...
1
vote
1answer
64 views

How to reference taxonomy used by other content type?

I have two content types: Content A and Content B Fields in Content A: Title, Location, Body Fields in Content B: Title, Type, Location, Body Location is a vocabulary (Au, Uk, Us, Ca, etc) Type is ...
0
votes
1answer
145 views

How can I get all fields and values of a node at once?

I know how to get a particular field (title field) of a node by following code: $publications = \Drupal::entityManager()->getStorage('node')->load($node_id); $title = $publications->getTitle(...
0
votes
1answer
451 views

Get node based target id from entity reference

We have an Article content type which has an Entity Reference field called field_document that is linked to the Media bundle type of Document. In mymodule we need to write a hook that will take the ...
3
votes
1answer
172 views

Memory leak when looping through nodes

I've got code that loops through nodes in order to generate processed output. I've previously done an entity query that provided an array of node IDs. My main loop code looks like this: foreach ($...
0
votes
0answers
10 views

Error: Event registration is not enabled

So I have a basic node with a button allowing users to register, it is not a custom module, but when I click the 'register to the event' button in debug mode it shows that message on the log and doesn'...
0
votes
0answers
24 views

Link entire teaser views row to content with core or contributed module?

When creating views I prefer use views modes rather than fields. I have been reading up on accessibility stuff and one topic that comes up is that adjacent fields, linking to the same url can be a ...
0
votes
0answers
16 views

Need to edit links in hundreds of nodes - can it be done via a module?

I have a number of nodes of a content type in which the body contains links using bit.ly. These links no longer resolve due to domain name changes to the original link that was 'bitlyed'. I've been ...
0
votes
1answer
44 views

session_unset logs out user when viewing the page

We have an application that we developed in Drupal 7 and I am tasked with migrating this form to Drupal 8. I have a question about the session behavior which seems to have changed from Drupal 7 to 8. ...
0
votes
1answer
297 views

Display multi-value entity reference field in node edit form as draggable?

Is there a way to display a multi-value entity reference field as a draggable widget in a node edit form? I'm looking for the exact same behavior that a multi-value image field has by default. I would ...
2
votes
0answers
47 views

EntityQuery with node_access module compatibly

I have installed node_access for maintaining access per node. I need to write a sql query using entityQuery service and display only those nodes which respect node_access configuration per node. I am ...
0
votes
0answers
18 views

Is it possible to store a query calculation result in a search index?

I am counting nodes of a specific type associated with terms with this query: $connection = \Drupal::database(); $query = $connection->select('taxonomy_index', 'ti'); $query->join('...
0
votes
1answer
40 views

How Can I do a content type with a 1:n field inside?

I'm a bit lost about how Drupal manage content. For example, I want to create a new content type called Game. When I create a "Game" I want to introduce "Platform" and "Release date". For example: ...
0
votes
1answer
45 views

I can see the changes I made (as an administrator) but as an anonymous user, I can't

Have you had any problems like this before? I appreciate your help. When I'm an admin and update a node (custom module), I can see the changes I made (as an administrator). However, when I'm an ...
0
votes
2answers
103 views

Display related media entities

We are using the Basic Page content type and it has an Entity Reference field (field_document) that points to the Document (Media bundle), which has a field_document_tag (taxonomy term field). The ...
-1
votes
1answer
49 views

module_invoke_all() pass arguments by reference?

when I implement the HOOK_node_presave , I can access to the $node and alter it ex: function drupal7_test_node_presave($node){ $node->title = 'Abricoooooooooooooooooo'; } the strange thing is ...
0
votes
1answer
34 views

Pass selected values to node add form

I have a view of nodes. I'd like to be able to select rows (thinking VBO is the best) and pass those selected nodes to a form (specifically /node/add/payments) to pre-populate entity references. ...
-1
votes
1answer
171 views

Get the node ID value after submitting an attached Webform to that node

I have a Webform attached as a field to a specific content type. After the node is loaded and the Webform is submitted, I am using the below custom webform handler to get the $webform_submission ...
0
votes
1answer
18 views

How do I create a log/statistics of on page events?

I am using drupal 7, I have seen there are already statistic modules but can't find any for my situation On my website I am trying to track certain on page activities which site admins can see in a ...
-2
votes
1answer
17 views

Different formatter's field by file extension

I have Drupal 7 and a file field and users can upload pdf, office documents and image. For pdf i have pdf.js formatter, office doc's have simple link to download and image show by fancybox plugin. I ...
0
votes
1answer
271 views

How to get the referenced node id in a webform?

I have a webform that is connected to a node in drupal 8. When the webform loads from the node link I need to get the source entity id from url. How can I achieve that in my custom module? the url is ...
0
votes
1answer
337 views

Output field with double quotes in twig

We have a field, field_text, that we are displaying on the Basic Page content type. It needs to display with double quotes " using twig template. We tried the following below, but it is displaying ...
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
81 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
49 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
70 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
81 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
23 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 ...
1
vote
2answers
760 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
225 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
893 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
19 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
327 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
56 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
34 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
45 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
28 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
49 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
30 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
34 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
120 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 ...