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
31 views

Make my view the default for content type

I am probably doing this the wrong way, so please correct me if I am wrong! I have created a new content type, called "Entities". My content type has many fields, and the default view when you visit "...
0
votes
1answer
29 views

Add content screens from the front end

I am building a web application (for trusted users), so the logged in user will have the ability to add content. However currently, when the user wants to add a record, they move from the frontend ...
0
votes
0answers
59 views

How can I display a webform on a node?

I am trying to display my webform using MYTHEME.theme file but I did not get any result. I am using code below: function THEMENAME_preprocess_webform(&$vars) { $wfid = $vars["element"]["#...
0
votes
1answer
22 views

Referencing “type” in nodes returned by loadMultiple();

I know there are easier ways to sort nodes by type, using views, or using: $query->loadByProperties(['type' => 'my_content_type']); ... but what I really want to do is return ALL nodes and ...
0
votes
2answers
52 views

Display the day of the week

I have a content type with various fields. One of these is a date field. After typing in the date I would like to display the day of the week to the right of the date.
0
votes
0answers
26 views

How can I append the node ID to the node title while saving a node? [duplicate]

When a node is saved, I want to append the NID to the title of the node. $node->title = "XYZ_" . $node->nid; If I put this code inside hook_node_presave(), it won't work because NID($node->...
2
votes
1answer
50 views

How can I get the parent node of a referenced node?

I have a node called project which contains field building as a referenced item, I used the the hook on building node insert and, having this building id I need to get project id which this building ...
0
votes
0answers
54 views

How to delete node of a content type if having millions of node

I have a content type in my Drupal 8 instance and having more than 2 millions (20 lakhs) node and want to delete those node, tried many things but nothing helps, either HTTP 500 error occur or Website ...
0
votes
0answers
34 views

How can I get the metatag_config site name by consulting my db with php?

I want to obtain the metatag_config data through a mysql query with php from my db drupal, in order to obtain the site name, description, keywords and abtract. How can I do it? Or where they are ...
1
vote
1answer
35 views

Fetching node field values programmatically

I have figured out how to query the node table programmatically without using the deprecated db_query() function. However, I soon discovered that the actual content fields are not held in the node ...
2
votes
0answers
36 views

Add an existing node as a translation to another node [duplicate]

I am migrating contents from a multilingual website. I'm using Feed modules to import all the nodes so, in the end, I have multiple nodes that are in English and multiple nodes that are in French. ...
-3
votes
2answers
42 views

Where might I place code to programmatically update nodes?

I want to update or set value of specific node/entity with one button that have function to update specific field on that node / entity? And put in on view tab on that specific node on a button? How ...
1
vote
1answer
26 views

Translatable image field gets replaced when adding content

I have added an image field with Translatable Content enabled. My content type has enabled translations too. But when I add an image in the translation, the english contents field get replaced with ...
0
votes
0answers
12 views

Print translated Image field in node template

$nodeObj = Drupal::service('entity_type.manager')->getStorage('node')->loadByProperties(['type' => 'books' ]); $nodeObj has field 'field_book_image' and 'target_id' => string(2) "65" in node ...
0
votes
1answer
23 views

How do I reference a file field and node title from another content type & node?

I need to add a link to a file, added through a file field on its own content type called "Document" from another content type and node call "plan information". The idea is that the "document" nodes ...
0
votes
0answers
16 views

Migrating into Double field

I am migrating a CSV into D8 node type which has a double field. The CSV has the following structure: I am trying to migrate the year, from the header, into the first double-field subfield (as a ...
2
votes
0answers
64 views

Webform module loosing language for referenced options

First I have content type "Quiz option" which is translatable. Then I have a view that returns Entity references of that type. For language option I selected "Content language of view row" and also ...
0
votes
2answers
55 views

Cloning nodes between multisite instances with separate databases

I'm working on a Drupal 8.6 multisite and my client wants to be able to duplicate content between many of these sites. The codebase of the websites is the same, but each of them uses a different ...
0
votes
1answer
47 views

import address data from CSV

I migrate my content from an old D7 site to D8 site. All went well, except the addresses from field address where not migrated to the new address field. Then I use feeds, feeds_migrate, content-...
1
vote
0answers
37 views

Can I alter the behaviour of a core function?

To make content management easier, for a large website we have allowed the content administrators to put a pipe in the title of a piece of content. Anything before the pipe is ignored. Is there a way ...
0
votes
0answers
14 views

Updating Solr search_api filters on node deletion

With Drupal 7 I am using a SOLR search index. The index covers a particular content type. I have a view which uses the search facets and displays a paged list of items in the index. My problem comes ...
1
vote
1answer
25 views

How to render translated node body in two languages?

I use entity_translation to translate node body field, so in a fully loaded node object body is an array of 2 languages ('en' and 'ru'). For specific node type I would like to render body in both ...
0
votes
1answer
50 views

Add Button to Node View

I want to add custom button on node page. I tried with hook_node_view but it didn't show up. like this: function mymodule_node_view(array &$build, EntityInterface $entity, ...
1
vote
1answer
45 views

Drupal::entityQuery

This is the official Drupal::entityQuery function definition I found public static function entityQuery($entity_type, $conjunction = 'AND') { return static::getContainer() ->get('entity....
0
votes
1answer
86 views

Export blocks added via layout builder as default content

I am using Layout Builder to add blocks into my nodes. I am adding several instances of different custom block types to specific content individually. I wander if it is it possible to export those ...
0
votes
1answer
49 views

Can I get the relationships of a node using node_load()?

I want to load relationships from the node_load(). So for example getting the article content type and loading the author information with the same query. How would I go about doing this? The end ...
0
votes
0answers
29 views

Link Field removing parameters for external links

I have a content type which uses the link field which I have set to external URLs only. When I put a website URL with more than 1 query in it, it won't render the second portion of the query at all. ...
-1
votes
1answer
34 views

List files in a directory as a table

I created a folder inside of my Drupal directory where my client can directly FTP into and upload or remove PDFs. What I'm trying to do is create a page called "Documents" which then displays all ...
0
votes
1answer
26 views

Output referenced entity in correct language

The following code outputs referenced entities in the original language they were created. {% for story in node.field_stories %} {{ story.entity.label }} {% endfor %} I want it to render in the ...
0
votes
0answers
16 views

Conditinal Field for Group Fields

I have a List Field on a Content Type. Just after that I have a Group Field. I'd like make it visible in relation to the value on the previous List Field. To sum up, to use Conditional Field Module ...
-1
votes
1answer
85 views

How to add multiple values to file/image fields while creating node programmatically?

I have multiple images coming dynamically in array. But while adding those images to node only last file get attached in field and other images only saved in file directory. I have tried everything ...
0
votes
0answers
43 views

Timestamp error when trying to view page revisions

When trying to view a node revision at <base_url>/node/<node_number>/revisions/<revision_number>/view/, I get The website encountered an unexpected error. Please try again later.&...
0
votes
2answers
30 views

How do you hide a page? [closed]

I'm using Drupal 7, can you tell me how to hide a page if the page does not have a menu settings at the bottom?
0
votes
1answer
32 views

Select all nodes, where date is greater then current date and repeat event option is empty

I have content type "event". In this content type I have a date field, provided by the Date Recur module. At the result I have range of the dates: Event start and end date. Also Date Recur provides an ...
0
votes
0answers
17 views

Show who published a revision/page - publish history [duplicate]

I would like to know which user published a page or revision of the page and when was it published. Is there something like publish history? In the image we can see only the revision (date and author ...
-3
votes
1answer
48 views

Create module that create Content Type [closed]

I'm developing module that creates a content type. I saw the same question and there was a solution. I had tried it but it didn't work. job_post.info.yml name: Job Post description: A job posting ...
0
votes
1answer
41 views

How to un-cache a specific node field (also for anonymous)

My goal is to replace (by a custom markup) the render array of field_product when some conditions are met. (in a ecommerce site) Ex: If this is the weekend or if it is after 12pm the field_product ...
0
votes
1answer
46 views

Scoping an admin link to only show for certain node bundles

I have 2 node content types / bundles, A and B. each A has a relationship with multiple Bs. When on the edit page, node/%/edit, for A, I want to show a link to the list of related B so that an editor ...
1
vote
1answer
76 views

Programmatically remove content from a group

In order to add a node to any group in Drupal 8, I use the following code. $group->addContent($node, 'group_node:article'); Now, for removing content from a group, I have tried $group->...
0
votes
0answers
18 views

How to refer to the node created date in Computed Field PHP

I am using the Computed Field module in D8. I am trying to compute some dates using the node created date as the start point. As my first try, this code works: $valuein = $entity->field_datefield-...
0
votes
1answer
30 views

Field contains list and values of it are shown in one symbol

I'm developing a drupal module and there's a problem. I need to make a content type with some fields and one of them should have list with string values. But when I try to create content and choose ...
0
votes
2answers
23 views

Display selected fields from referenced node rather than just referenced node title

I've searched for an answer to this, I can't find it for the life of me. I want to in a node display additional selected fields from referenced nodes, not just the title field of the referenced node. ...
1
vote
0answers
43 views

How to display the parent node or product of a comment?

I installed the Message module on my site. I created a custom module that created a message when a comment is created. https://imgur.com/a/4OLhGlL How to display the parent node or product of a ...
1
vote
1answer
191 views

Change field label used in node display

I have a custom content type in Drupal 8.6.x. I want to be able to change the text used for a field label based on the value of a taxonomy term reference in the node. For example, I want to change ...
1
vote
1answer
27 views

Where are the settings for read time module in admin area? [closed]

Installed the read time module and can not find any settings in the admin area. The description says its configurable, but where? I can see the field in manage display, but the article is not ...
0
votes
0answers
27 views

When I try to edit nodes from a specific content type they throw an error

When I try to edit any node from my Page Template content type it gives me a blank screen with this error, The website encountered an unexpected error. Please try again later. then when I go to the ...
1
vote
1answer
41 views

Get unsaved node from route parameter

What I want: In hook_media_presave I want to set a field value according to the same field on the referring node. By the referring node, I mean the node where the media entity is created through an ...
1
vote
0answers
22 views

Attaching webform to node

I have a question regarding the webform module. Is there a way to automatically attach a webform to a type of content? I have done something similar through adding it as a field in that content type, ...
0
votes
1answer
56 views

Node field not sanitize on render

I have a form for users who want to add new content on my Drupal 8 website. I render node field on a twig template : {{ node_field_title.value }} But field are not sanitized by Drupal. Is it the ...
0
votes
0answers
16 views

Why are only some nodes represented in simplenews_statistics table?

I've only got 5 nodes represented in the simplenews_statistics table. This means that only 5 nodes produce anything other than a blank page for statistics. The code that adds to the ...