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

How to let a user create a private node and grant access to other users?

I am using the module Group, and as the name implies, it does create groups. But, I need a way for users to create private nodes and grant access to one or more users. I would also like for the same ...
0
votes
1answer
40 views

I can't override the node template

I have installed Barrio Bootstrap (8.x-4.33) and it worked so far. But I can't override a template for a specific node type. I copied the original template into my subtheme/template folder and named ...
-2
votes
0answers
66 views

PHP content cannot be created or modified after ISP migration

I recently migrated my Drupal 7 sites to A2 Hosting. Everything was working fine, until I had to edit a node which had some simple PHP code content in its body (it only shows different links if the ...
1
vote
0answers
27 views

Updating a Node image field from an external URL

I need to retrieve an image from an external URL and then save the image on Drupal's file system, and then set the image as the image for a node. In D7, this was a pretty simple task, but it's causing ...
0
votes
1answer
26 views

How to change node field label for some specific conditions?

In preprocess_node I wrote this and when I do kint($variables['node']) I can see that label is set to "test", however on display it appears with the old label. How can I change the label ...
0
votes
0answers
21 views

Conditional display mode for entity reference field

i am having a paragraph with 2 fields : Slider : field_gallery_slider / Booléen Images : field_gallery_image / Référence à une entité media How could i change the media display mode if the ...
1
vote
0answers
28 views

Render Twig Template instead of standard node fields [closed]

Right now my custom module creates a new content type. When an admin creates a node of that content type and save it they see the standard form elements displayed. However the custom module creates a ...
-3
votes
0answers
23 views

Want to check node access permissions on every page with custom module [closed]

I am building a custom module , where our company employees only will access the content pages. Here we placed one form with just ORG ID as login and needs to check that field available in particular ...
1
vote
1answer
40 views

Post content via JSON API: CURL works, PHP not?

I've got those modules enabled: HAL HTTP Basic Authentication JSON:API REST UI RESTful Web Services Serialization When I run this command, the content is created. curl \ --user demo:9aqW72MUbFQR4EYh ...
0
votes
1answer
16 views

Token path to file URL, filename, etc.?

I'm writing a Rule that sends an email when a user uploads a file to a node. How would I output the file's URL and filename in the body of the email? First, some things to note: This is an Entityform ...
0
votes
0answers
27 views

How do I use a core class from an external script? [duplicate]

I am trying to access a node programmatically and getting errors though using (AFAIK) the recommended way. My code (so far) is really simple. use Drupal\node\Entity\Node; $nid=1805; $node = Node::...
0
votes
2answers
41 views

How to hide all nodes of a particular content type?

I have a site that used to run polls, but has stopped doing so. I'd like to keep the poll nodes in the database, just in case things change in the future, but otherwise hide the nodes. I guess this ...
2
votes
1answer
38 views

Exclude specific nodes from a view based on role permissions

I am using View access per node to hide certain nodes from the general public and allow specific roles to view it, which is simple and works like a charm. The issue is that those nodes are shown, even ...
-1
votes
3answers
55 views

How can I keep new nodes within a certain range of IDs so as to not conflict with migrated node IDs?

In Drupal 8, I am preparing a migration and at the same time, the users are adding nodes of content manually. For the migration I need to keep the same node ID as the source. Is there any way I can ...
0
votes
0answers
39 views

If I have 2 same name taxonomy term which is used with nodes. how to set only one instead of both?

I have 2 taxonomy terms with the same name (knight(2) and knight(6)) in my Drupal 8 Project; both terms have been used with nodes. I want to replace knight(6) with knight(2) in all the nodes. I ...
0
votes
0answers
40 views

How do I check node access permissions in a module?

I am building a custom module, where the company employees need to access the website without logging in. They will enter their employee ID in a form and store it in a cookie. When the cookie is valid,...
0
votes
0answers
55 views

How can I programmatically insert/update thousands of nodes?

I have to insert 2k nodes with my custom module but it takes forever. I know there is a way to delete a lot of nodes with only one operation: $storage_handler = \Drupal::entityTypeManager()->...
-2
votes
2answers
75 views

Why doesnt my migration plugin run?

I made a plugin to add the alias to my node migration, using the instructions here https://www.calebthorne.com/blog/drupal/2016/07/16/drupal-8-migrate-pathauto but i tried to put a drush break point ...
0
votes
0answers
26 views

Filtering by User Reference with JSON API

I try to filter some data by User Reference. My problem is, it return me an empty list "data": [] It only works if the authenticate user own's the data... My request : {{url}}/api/node/...
1
vote
1answer
62 views

How to properly manage field types for a content type created by a module?

I'm a bit confused about two different errors I get, which seem to contradict each other. I guess I didn't register my field types properly. The first one appears when I try to uninstall my module. ...
0
votes
0answers
39 views

Mixing node content with custom PHP code

I got a "normal" node that contains some simple text content like this: This is how our internship program work ..... After that text I want to include a list of our current team members. ...
0
votes
1answer
28 views

Checkboxes in access panel won't stay unticked

There's a page on my website that can't be made public because the checkboxes in the access panel - when I try to edit the page - won't stay unticked. I untick the checkboxes and hit save, but when I ...
0
votes
1answer
35 views

How to add a view tab to node edit form?

I have two node bundles: events and registrations. Registrations have an entity reference field pointing to a given event. I have a view, that list registrations with some event and registrant ...
1
vote
1answer
97 views

Show node links in modal buttonpane

I want to show some node fields in buttonpane when I open node in modal. As far as I know, it will automatically show there inputs with type submit and links with class button, but I added class ...
1
vote
1answer
21 views

Creating a fallback field to load conditionally

So if I have a node type of Article. I have two fields on it: field_image field_secondary If field_secondary is being used, I'd like for that to be shown over field_image. Can anyone help point me ...
0
votes
0answers
37 views

Programmatically remove an entity reference field

I am new to Drupal 8. What I want to achieve is to delete the taxonomy term (entity reference) and its association from the nodes where it is referenced. Node has multiple languages, revisions, ...
0
votes
0answers
73 views

How to organize the summary of a book?

I created a book with the module provided by Drupal 8, but I am unable to organize the pages of the book correctly in a view. I want to organize the book in this way. In the left block, pages and sub-...
0
votes
1answer
35 views

Convert node ID from string to integer

Retrieve a node based on condition: $query = \Drupal::entityQuery('node') ->condition('type', 'my_content_type') ->condition('title', 'my node title'); $nid = $query->execute(); The result ...
0
votes
2answers
29 views

Change article layout on homepage

I would like to change the layout of articles on my homepage. But I cannot find the template hereof. I've got my page.html.twig, which but that only includes a placeholder "{{ page.content }}&...
0
votes
0answers
18 views

Display taxonomy parent tid of a taxonomy term reference field

On a node template , i am displaying a taxonomy term ( entity ref field ). That taxonomy term has a parent. How can have that info on the html generated , for css purposes ? The field.html.twig ...
1
vote
3answers
61 views

Missing form state values after adding submit function

I added a submit function in the form_alter hook when inserting a node: $form['actions']['save_as_draft'] = [ '#type' => 'submit', '#value' => t('Save as Draft'), '#submit' => ['...
0
votes
0answers
16 views

View with multiple node arguments using an entity reference

We have a node type called: MEETING On Meeting we have a user entity reference called: PARTICIPANTS I create several MEETING's and reference 2 users: USER1 AND USER2 Now I want to build a dynamic view ...
0
votes
0answers
35 views

How can I show/hide node field values the same way items are shown/hidden in /admin/modules?

When viewing a node of a specific type, how can I show/hide the values like in /admin/modules? I want to be able to click on the field title and show or hide the value. Is there a module that can help ...
0
votes
0answers
14 views

Displaying sub content (entity references) of node based only with specific taxonomy

I have been working on a solution that would allow training courses to be created using Drupal 8 as the backbone. I have elected not to use the "Courses" module and am simply using custom ...
0
votes
2answers
61 views

How do you target a specific type of content?

I have the content type (node), article, page, recipe. The code below can be used to flag any type of content. How do you target a specific type of content ? For example I only want to flag the ...
0
votes
1answer
30 views

How do I get the administrator to automatically flag?

I created a module for flagging entities automatically when created or updated. There are some errors in my code because only nodes work. If a user "user1" creates a node, the flag will be ...
0
votes
1answer
44 views

How to properly program AJAX links?

I have a custom module that uses AJAX. Everything works fine the way it is. I'm just wondering if it's the proper way to do it in Drupal. I'm new to Drupal 8 and 9 programming This is a line from my ...
0
votes
1answer
35 views

How to programatically hide node field on viewing?

Using Drupal 9, How do I hide a node field when viewing it? Let's say I have field info. I would like to conditionally not display the label or the value. I assume I use hook_node_view_alter but I'm ...
0
votes
1answer
28 views

How to remove images from body field in views?

In the body field of a content type, I have added an image at the start. In my view, I want to show 200 characters from the body field. It also prints the image. How can I skip the photos from the ...
0
votes
0answers
14 views

Search API autocomplete: How to get Node ID in suggestions?

I am using https://www.drupal.org/project/search_api_autocomplete for autocomplete search results is it possible to get Node ID with suggested results? Thanks
0
votes
0answers
17 views

Get Paragraph's Parent Node Before the Node is Saved in Constraint

I have created a Paragraphs Constraint and I am unable to get access to the parent node's bundle in the constraint because the node has not been saved yet. public function validate($entity, Constraint ...
1
vote
0answers
23 views

Copy a field's value to another field and modify it

I have content type "Video" When i do a new "video" I have a field "iframe_vimeo" thats it contains a value of the iframe's video link. I want to do some modifications ...
0
votes
1answer
11 views

Programmatically setting video_embed_field URL

I am trying to populate nodes programmatically from a feed (migrating earlier site to Drupal 9). So far I have managed to get everything else to move, but I can't figure out, how to set ...
1
vote
2answers
47 views

How to let users allow other users to view specific node content?

I'm using Drupal 9 I would like users to be able to allow other users to view their node content. Ideally a user will request access to view the content and the content owner will grant them view ...
3
votes
1answer
67 views

How can I save an unpublished node skipping required fields validation?

What is the best way to save node without the required field values? It would be something like "save as unpublished" and the required validation is omitted, but I am not sure in which ...
1
vote
0answers
24 views

Node access audit by user?

I have a unique need to log all attempts, with timestamps, by all users to access nodes of a given content type in Drupal 8/9. We wish to use our existing Drupal site to collect submissions of ...
2
votes
1answer
95 views

How to modify field value in other nodes after node update?

After node update I need to modify a field value in several connected nodes. As I know, I cannot use hook_entity_update() since $node->save() forms infinite recursion. How can I modify node fields ...
2
votes
1answer
28 views

Reasons for using a webform node rather than just linking directly to the webform [closed]

Other than reuse, is there any reason why I should not link directly to a form in Drupal 8? I mean linking directly to the webform rather than to a node that incorporates the webform?
0
votes
1answer
31 views

How to create arguments in path with regular page node instead of module, yet pass them to a module

I know how to create a URL with hook_menu() in a module, but is it possible outside a module? Here's what I'm needing/asking: My front-end guy wants to create a page as a node using a Content Type via ...
0
votes
0answers
23 views

How to execute migration on selected nodes thru core bulk action plugin?

I'm trying to execute migration to create a copy of selected content nodes to other content type. Migration source (plugin: content_entity) is content_type_a and destination (plugin: entity) is ...

1
2 3 4 5
147