Questions tagged [nodes]

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

Filter by
Sorted by
Tagged with
1
vote
2answers
39 views

How can I retrieve the current node ID on a custom route?

I have a new route and the yml file looks like this: rsvplist.form: path: '/rsvplist' defaults: _form: '\Drupal\rsvplist\Form\RSVPForm' _title: 'RSVP to this Event' requirements: ...
0
votes
0answers
22 views

How do I create an entity reference from a webform submission?

I have two content types : Parents and students. each content type has a entity reference to the other content type. I am using module : webform and webform creator to create the content. Once a ...
0
votes
1answer
35 views

Is it possible to get the node ID of the node that will be created?

Trying to pass some information to third party API, every time a new node is created. So far I have managed to identify the node insert/create when a node is created in hook_node_presave(). Done it ...
1
vote
1answer
16 views

Drupal 8 correspondence to node_access function on Drupal 7

I feel like asking a silly question, but here it is anyway: I need to test if a given user (in my case, the logged in, current user) has access to a given node for one of the existing operations (view,...
0
votes
0answers
21 views

How to render related nodes by vocabulary X on vocabulary Y terms?

I did many research about related nodes by term. These solutions are good with related nodes by term on node pages but does not work on term pages. Solutions I found: Add "Content: Has taxonomy term ...
0
votes
0answers
15 views

Ensuring a smooth node-add routine

I am building a site in Drupal 8, where users can add training programs. An example of such a program could look something like this: The way I see it, I will need 3 node types: Node type 1: Program (...
0
votes
1answer
29 views

How to display since when the node was created? [duplicate]

How to display since when the node was created with TWIG. Here is the templace of my node : <div class="card mb-5 p-0 overflow-hidden shadow rounded bg-white"> <div class="card-header ...
0
votes
0answers
10 views

How to display field labels in Views lists that show full content or rendered entities?

I have a view that displays multiple content types and for this, I went and created custom displays. It works fine except that Views seem to strip all fields from labels. I did a dump of twig fields ...
0
votes
0answers
36 views

Type-specific fields for different categories of content type

I have a contract content type on my Drupal 8 site, and I would like to use the same content type for multiple different types of contracts. 95% of the fields are common for all types (contact ...
-2
votes
2answers
223 views

Clone a node table while all cloned table cells have in-place changeable input placeholders [closed]

To help others and myself learn new human natural languages I want to create a program for translating phrases shared between generally all such languages ("basic phrases"). Although, using this ...
0
votes
0answers
24 views

How to create a table-structured content type?

I am creating a content type which needs to be in table format. The table structure looks like below: Main title for the table 1: ........................................................ First row ...
-4
votes
1answer
23 views

Why is my db_query not working? [closed]

i am trying to display my content types and their info in a table format. First thing i want to do is make sure i am connected to the database. It seems i cant connect to the database. Please assist. ...
2
votes
1answer
52 views

How to delete all revisions of given content type except the current revision?

I am having a very large website which have around 400000 nodes of story content type. And these nodes have around 2000000 revisions. How can I delete all the revisions except the current revision so ...
1
vote
1answer
33 views

Limit multiple fields node add form

How can I (either with a module or programmatically) limit the number of values for multiple fields? For example, the user can add only a single value for field A OR field B OR field C. The total ...
1
vote
1answer
47 views

Filter nodes by paragraph user reference

Say you have a content type Exercise which has a Related Users paragraph field. In turn, Related Users has a user reference field: (content type) exercise --> (paragraph) related_users --> (user) ...
0
votes
0answers
23 views

How do I select which node fields to display while typing in an entity reference field?

I created an entity reference field to select News items to display on a page. News is a content type. How do I display not only a title, but other stylized fields of a node as I type in the entity ...
0
votes
1answer
11 views

Fill the “Unpublish on” date field of the Scheduler module depending on list field

I have a content type, where I want to give the user only three possibilities to unpublish content: in 1, 3 or 6 months. For the selection of the three options I use a list field. How can I transfer ...
2
votes
2answers
214 views

Where is the node created timestamp stored in the database?

I need to create an SQL query that finds all nodes of a certain type created X days ago, so I can get their IDs. Due to the massive number of nodes in the database, I would prefer to use a direct SQL ...
2
votes
1answer
37 views

How do I programmatically delete a node by internal url alias?

How do I programmatically delete a node with a specific internal url alias? Background: We are trying to delete this node so that it can be replaced during an update hook.
0
votes
0answers
20 views

Insert data into the database [duplicate]

I try to save some data I get into a form in the database but I don't know how to do it. Currently, here is what I have in the database (I try to add articles). As you can see I already have 2 of ...
0
votes
0answers
20 views

Status on node is not changed during query update

I'm updating a node's status to unpublished and the status in node_field_data is changed from 1 to 0 but in the content view, status is published and when editing the node, the publish checkbox is ...
1
vote
1answer
37 views

If content type with specific field that is not empty has specific taxonomy term attach library [closed]

I would like to attach a specific library using a taxonomy term to a content type with a specific field that is not empty. The following is not working: function lehigh_preprocess_page(&$...
0
votes
0answers
25 views

Services module retrieve node with PHP text format

I have successfully connected to a Drupal instance using JSON and even retrieved a node using the service. Problem is that the node has php content type, and the service returns the raw php content ...
-1
votes
1answer
60 views

Function to get node view mode name

I've been using $node->getType(); to get the content type. For view mode, I am following this method: Is there a function similar to getType() (that doesn't require adding a preprocess ...
3
votes
1answer
38 views

How do I free the memory used from node_load()?

I am using code similar to the following one. for ($i = 0; $i < 1000000; $i++) { $nid = get_node_id($i); $node = node_load($nid); $data = [ $node->field_1, $node->field_3, ...
3
votes
2answers
77 views

How to get node's view mode in hook_page_attachments?

I need to get the node's view mode so that in the mymodule_page_attachments, I can add libraries conditionally if the node's view mode is set to full or default. I tried the following but not able to ...
0
votes
0answers
13 views

How to show the User Picture automatically (By default) in the Node creation and in the published Node?

I need to display "User Profile Picture" as a field (it must be displayed by default, without the user entering it as an image in the field, otherwise it would be too simple, but somehow the field ...
0
votes
2answers
64 views

Select all checkboxes of an entity reference field on creating a node

Drupal 8.7.x For one of my content types I have an entity reference field referencing a taxonomy vocabulary. I have a lot of terms in this vocabulary which makes it tedious to check all the ...
0
votes
1answer
20 views

Show workflow transition bar in all states

I've created a custom workflow using the workflow module with the transitions listed below and I've noticed that when going to the view page of a node the workflow 'bar' that lets you transition a ...
1
vote
1answer
29 views

How to create node twig template suggestions for one content type?

I need to create a node twig template that is just for the basic page content type that based on a custom field on the content type. We have other content type like Article, Blog, Products that do not ...
0
votes
0answers
18 views

How to choose content field shown in View using URL parameter?

I have contentType Screenshot which has 6 Image fields shot1..6. Then I have a view screenshots_1 which shows shot1 in a grid. I need to have 6 paths, e.g. /screenshot_1..6 each pointing to same view ...
0
votes
1answer
25 views

How do I exclude a node from an entity reference field?

I have a homepage content type which has a featured_article field, an entity reference field that allows the editor to choose a single node from the Article nodes. That node is displayed as Featured ...
0
votes
2answers
39 views

How to reuse existing images in field type “Image”

I have custom ContentType with one field of type Image. Currently, when I edit a node I can only upload new images from local to server. I want to have the option to select images already existing on ...
0
votes
0answers
19 views

View with Taxonomy Path

We have a taxonomy vocab called Phones that goes like this. Taxonomy: Phones -Nokia --3310 --Jitterbug --7.1 -Samsung --Galaxy S6 --Galaxy Edge --S7 -HTC -- one --S7 list goes on, but you get the ...
2
votes
1answer
35 views

How to update a field on menu_link_content (added using menu_item_extras module) entity from node form

I have a checkbox field added to one of the menus using Menu Item Extras module. By default, the checkbox is checked and works as expected when I create a menu item via menu admin UI. however, when I ...
0
votes
0answers
41 views

Filter a view displaying nodes of one type using a user entity reference field on that node

I have a vocabulary (Countries) listing all countries. I added an entity reference field to the User entity (Nationality) referencing the Countries vocabulary. To the Article content type, I added: ...
0
votes
1answer
43 views

How can I loop through all article content types and get the content of each

I created a new article content and am overriding that by creating a template for it (ie: node--4.html.twig). Then inside this template, I want to loop through all nodes that belong to article ...
0
votes
1answer
38 views

Create nodes unlimited times

I've been trying to ajaxify the node creation form, the purpose? Save the node and remains in the node creation page (Done) If the user clicks the save button again save a new node The second point ...
0
votes
0answers
22 views

Programmatically add field collection items to a node [duplicate]

I have a node with a Field Collection [field_videos]. I would like to be able to progrmatically load a node and add field collection items. The field collection contains the following fields: ...
0
votes
0answers
8 views

How to fix malformed geometries in geofield

I have a form that allows to add geometries to a node. It features a geofield map widget where you can also add geometries using a WKT field. Plenty of users have used this field. However, some of the ...
1
vote
0answers
21 views

How can I alter the node title in every display?

I have a content type "Campus", I would like to concat to the title "Campus name campus". So, there is a hook or something to alter the node getTitle() method in every display? I've tested: ...
0
votes
1answer
29 views

How to remove Home title from the home page?

There are several posts on a similar question. Despite that, I couldn't find the best way to resolve it. Display Suite is installed but don't see option to turn off page title. Our home page content ...
1
vote
1answer
45 views

For each image uploaded in a node: get the url

I'm begining with Drupal 8 and I want to get the url of the photos in the content I create to display them. The context is : a photograph upload pictures for a customer. This customer can see it on a ...
0
votes
0answers
18 views

Node as field in content-type

I have one type of custom node called "Concerts", and another type called "Conductors". I would like to add a field to Concerts indicating which conductor led the concert. However, the field types I ...
0
votes
0answers
31 views

Getting white screen in Login /user and the page content

I was recently editing a website with Drupal 7 installed, and was integrating twitter feed. I created a block twitter_feed_block and assigned the block to the content section of the front page. It ...
0
votes
1answer
11 views

Anonymous permissions with Nodeaccess

Content type: Webform Allowed grants: View, Edit Allowed roles: Anon, authorized, admin Go to the webform node eg. node/20 Click Grants tab Tick authenticated and admin users can View, anonymous is ...
0
votes
0answers
20 views

How can we set entity refrence view in #selection_settings programtically?

I want to attach "game_name_entity_reference" view to autocomplete field in programmatically. Can we do this by #selection_settings attribute? or any other way?
0
votes
0answers
11 views

How to implement autoincrement field using inline_entity_form module in field collection?

I have 1 field collection in that added the entity reference field and set widget "Inline entity form-complex". Now i want to show auto increment number in "Game Code" text field. I have tried with ...
0
votes
0answers
43 views

Error “The value you selected is not a valid choice.” in drop down list

I want to list node titles in drop-down list programmatically. I have done below code in form_alter hook. function product_custom_form_alter(&$form, FormStateInterface $form_state, $form_id) { ...
0
votes
1answer
48 views

In Views, display additional fields from an entity reference

I have a content type with a field that is an entity reference to another content type called "URLs", and the "Allowed number of values" is set to "Unlimited", meaning that one record can have ...