Questions tagged [nodes]
The most basic form of content on a Drupal site is a node.
7,537
questions
1
vote
0
answers
72
views
Setting latest revision has been delayed
We are (still) using Drupal 8, the latest version, as a CMS for content editing.
Our platform is huge and it has 100+ editors who are constantly adding/editing content, and also 20 importers which are ...
1
vote
1
answer
625
views
Make Title field "not required" or workaround how to prefill and hide it (drupal 9.2.8)
On my site (drupal 9.2.8) users add content and there is no need to put any information to 'Title' field.
I was trying to make this field not required via form_alter in custom module but it did not ...
0
votes
0
answers
34
views
Provide menu link when creating node programmatically and append it to parent menu link
I am creating a Node programatically:
Node::create([
'title' => "Some name",
'type' => "people",
'body' => $params['body'],
'field_people_degree' => $params['...
0
votes
0
answers
1k
views
The "node" parameter was not converted for the path "/node/{node}"
I have the following error in the filters with parameters in view type pages. will there be any solution to this problem?
Drupal\Core\ParamConverter\ParamNotConvertedException: The "node" ...
0
votes
1
answer
133
views
SQL Error when trying to remove content type field
I was trying to create a new Content Type for my site and I chose a field name ("description") that already used for other content types.
The problem occurred when saving changes as the ...
0
votes
0
answers
383
views
Adding custom field generated by drush to available fields on node
I have an existing custom module on my D9 website and I need to make some changes inside it. I want to add a field (boolean) into any content type page edit without doing it manually.
So I need my ...
-1
votes
1
answer
1k
views
How do I access the protected value of node entity?
I have a view node and I use the below code to Kint out the node objects:
$node = \Drupal::entityTypeManager()
->getStorage('node')
->loadMultiple();
dpm($node);
returns the below ...
0
votes
0
answers
73
views
Is there a way to customize a ListBuilder for a specific node content type?
I'm having trouble with listing nodes and content types. There are many different content types in my drupal site, and all of them are listed inside "contents" page (/admin/content). I can ...
0
votes
1
answer
30
views
Is there a way to synchronize a webpage from another website into Drupal?
A restaurant has its menu database in Foodpanda.
The owner wants that menu to appear in the website.
We can manually duplicate all menu courses from FoodPanda to Drupal, upload the same images, etc. ...
-1
votes
1
answer
168
views
How do I programmatically set a content reference by name for a node?
Hi team i have some isssues.
I'm creating a node and i would like to set a content reference by name not by id, i'm doing this but this is not working:
'field_content_type_items' is referenced to ...
1
vote
1
answer
279
views
How to import a custom content type in phpunit
I'm trying to write some PHPUnit Kernel tests that use a custom content type which seem to work until I try to reference fields on the content type. I'm guessing the content type isn't being imported ...
4
votes
1
answer
399
views
How to prevent a node from being deleted while performing a delete operation?
I want to prevent a node from being deleted while a delete operation is performed on it. For example in administration panel if user clicks "Delete" on the node, the node shouldn't be ...
0
votes
1
answer
53
views
Auto create a feed when a node is added
I am looking for a way to automatically add a feed (of a specific feed type), whenever a node is added (for a specific content type) using the node fields to auto-create the feed.
I have searched this ...
0
votes
1
answer
183
views
Is there a way to render the title of every node from a single content type?
I have a page on a Drupal 9 site that will have a filter and a search bar. The filter needs to have each product and each region the product is sold in.
So I created 2 content types - Product and ...
-1
votes
1
answer
173
views
How do I suggest to use a template name like "node--[content-type-name]"?
I would like to name my node template after the content type title, but my suggestions only show the node number.
FILE NAME SUGGESTIONS:
html--node--1.html.twig
html--node--%.html.twig
html--node....
-3
votes
1
answer
320
views
The website encountered an unexpected error. Please try again later. as shown in body [closed]
I tried to set up my drupal 8 full project on localhost but after set up when I run project
getting error as shown below:-
The website encountered an unexpected error. Please try again later.
Drupal\...
1
vote
1
answer
72
views
How to differentiate two different node creation/edit pages
I have 2 views, each one with a type of node (Products and Users). I want to add a unique class in each node create/edit pages, but i can't find any difference between the two, the only way i found is ...
0
votes
1
answer
135
views
Show two content types in same view
Drupal 8 newb here,
I have two basic types I need to show in my front page: There’s a “Restaurants” content type and a “Chefs” content type.
These are shown in my site like this:
The types are ...
0
votes
1
answer
125
views
Within a node template how can I tell what regions are in use/ occupied?
I am trying to create a preprocess function in my .theme file in order to make a variable available to node templates.
I want the variable to contain just the names of all regions that are currently ...
1
vote
0
answers
42
views
Custom display in saved Entity reference in Widget field
We have an entity reference field widget. Based on a view where you can enter the code of a product to get to the product reference.
The widget shows the 2 fields (code) - (Title) when we type in the ...
1
vote
0
answers
66
views
Creating default content on site install with related entities
We use the Default Content module to install default content on each new site of our multi-site Drupal platform. Version 2 changed to only use UUID of the content you are exporting (done from the ...
2
votes
0
answers
1k
views
Missing bundle for entity type node after upgrading
I recently upgraded a local sandbox to Drupal core 9.2.4. While testing things out, I got an error when trying to add a new article content from /node/add/article.
The log shows the following message.
...
0
votes
1
answer
39
views
Custom Migration Plugin MySQL Error
I've run into the following error when running the command drush migrate-import custom_spotlight
where custom_spotlight is the name of the plugin. I've been following along with this guide: https://...
-1
votes
1
answer
53
views
drupal custom callback in node edit form is not firing
i am fairly new to drupal , i have custom button added to one the content type edit page , when i click on that button i want to call a function but it seems like it is not calling function when i ...
0
votes
0
answers
33
views
How to get the field data
Hi i'm using entityreference, i hava an content type"test" that contain a field that refer to categorie and this categorie contain a field_theme also referenced to another content type ...
0
votes
1
answer
46
views
How do I display a tour on a node?
On a Drupal 9 site, I installed the Tour and the Tour UI modules, and created a node.
How can I configure the Tour UI to show a tour on that node?
I don't know what to put in Module name and Routes.
1
vote
1
answer
26
views
How can I make 3 different menus?
I need to do an Agenda in Drupal 7. The table for the events is more or less already done, but I would need to add 3 days on the top like:
Day 1 - Day 2 - Day 3
Depending on which day is ...
0
votes
2
answers
1k
views
How can I use contextual filters to display a block with field values from a single related entity?
I've found various recipes/threads with the scenario where have a content type A node and want to display in a sidebar block, all the related content type B nodes, with the relationship based on an ...
0
votes
0
answers
11
views
Display in f2 only terms related to selected term in f1
I have a site that consists of a few parts like: Cosmos, Hi-tech, Travel, Music.
Each part has its own Categories. And I have made two Taxonomy vocabularies:
Part of a site
Categories (this has field ...
1
vote
1
answer
568
views
Programmatically verify a taxonomy term has been added to a node
I'm currently checking the node type and status, using the following code.
$query = \Drupal::entityQuery('node')
->condition('status', 1)
->condition('type', 'content_page')
->execute();...
1
vote
0
answers
62
views
Edit a node in the settings tray?
I am looking at this page in the Drupal docs for the Settings Tray and wondering if this can be used to edit the current node you are looking at, similar to this image:
Is there a way to edit all of ...
0
votes
1
answer
101
views
Display Node Local Tasks Menu on View
I have a view that shows registrations for an Event (Content Type).
This tab is shown in the /node/{node}/edit:
This registrations tab refers to the view, which I have inserted in the routing.yml:
...
1
vote
1
answer
214
views
Add a hero image and text when a node goes from unpublished to published
I'm trying to add a hero image and text when a node goes from unpublished to published. The things include:
Add an image from my media library to a media field on the node
Add a page title to the ...
1
vote
2
answers
1k
views
How to add a secondary Ajax submit to a regular node form?
I'm trying to add an Ajax submit to a regular node edit form (Drupal 9). I'm using Field Groups so that there's a series of tabs, and I've added a pair of "buttons" (Right now they're just ...
0
votes
0
answers
24
views
Get the breadcrumb inside my node template [duplicate]
How can I move my breadcrumb from my page.html.twig into my node--content-type.html.twig ?
In my page template, I display the breadcrumb like this :
<div id="main-wrapper" class="...
0
votes
1
answer
423
views
Get path (alias) from SQL query
I have a SQL query to get all nodes with their ID, title, publish date, change date, etc.
Additionally I need to get path to each of them (probably from path_alias.alias).
Now I have following (...
1
vote
1
answer
3k
views
Programmatically publish unpublished nodes
I want to publish unpublished nodes in a custom action. To do this, I query the database on a specific condition and want to use 'exists' condition to find the node IDs to publish. This is the code I ...
-1
votes
1
answer
41
views
Set "select" field on a node programatically
I am creating nodes programmatically on a specific content type. The content type has a "select field" that I am trying to set value with and cannot do it. Below is my code:
$node = \Drupal:...
-3
votes
2
answers
301
views
Display all the nodes from a specific content type on the front page
I have a custom content type (news). I want to show all those nodes on the front page.
How can I achieve this?
0
votes
1
answer
240
views
Can't add an image extension to the field_image of the Article content type
I need to upload an image with the webp extension and add it as the main image of a content item with the "Article" content type. Since its field_image doesn't have the webp extension by ...
2
votes
1
answer
2k
views
How do I programmatically publish the latest revision?
My workflow is draft and publish.
I create and publish a page.
I create a draft of the page.
There is now the published page, but the latest revision is the draft.
How do I programmatically set as ...
0
votes
0
answers
27
views
Is there any possibility to capture an array with all nid of a view?
I tried using hooks but in $view->result variable I only get nodes from the actual page (10 nodes because pager size is 10). My view has multiple exposed filters so I want the resulting nodes from ...
0
votes
1
answer
645
views
View Bulk Operation with custom action
I have a custom action to update some table values base on node content selection. My custom actions are listed correctly on bulk update select box. But I can perform operation some random node ...
0
votes
0
answers
37
views
New node of content type always as new book
I have two content types: my-book and my-page.
Is it possible to automatically create a new book (using the Book module) when a my-book node is created?
I was looking into using hook_node_presave(), ...
2
votes
2
answers
1k
views
How can I add a node template suggestion by node title?
Twig debugging is suggesting node--4.html.twig as template file for a node whose ID is 4. Since the node ID changes when changing environment, I would need to use a template file whose name is based ...
1
vote
1
answer
16
views
Add relationships that has 3 layers, Parent -> Child1 -> Child2
Recently I asked a question that was similar (Parent node needs to display the scheduled date that is referenced in the child node), but requirements have changed and now I'm dealing with the Node A (...
0
votes
1
answer
487
views
How can I view the list of referenced nodes when viewing a node?
I have a content type with a Related pages field, which an entity reference field for nodes.
How can view those nodes while still on the current node?
I tried to achieve this by creating a block view, ...
1
vote
1
answer
36
views
Parent node needs to display the scheduled date that is referenced in the child node
I'm not sure how best to approach this problem and I'm hoping someone can point me in the right direction.
Quick summary of the setup of some nodes:
Node A is the parent node.
Node B is a child of ...
0
votes
1
answer
72
views
What is the equivalent of Joomla's {loadposition} and {loadmodule}?
I have recently converted from Joomla to Drupal. I am still learning how to use it but I can't seem to find answers (esp for Drupal 9 not some ancient version usually coming up with google search) how ...
0
votes
0
answers
74
views
ckeditor not loading rich text editor by default
I'm running CKEditor 7.x-1.19 with Drupal 7.80.
With "Default editor state" set to Enabled, and "Show the disable/enable rich text editor toggle" set to Show, my system is still ...