Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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

0
votes
0answers
12 views

Is there a module to display php in content displays like the one for views? [on hold]

In views I can create a field that displays PHP with the views_php module. I can paste php and my field displays dynamically, like this: <?php date_default_timezone_set($row->...
0
votes
1answer
13 views

Can not use a comment display mode

In my comment type, I created a "teaser" view. When I enable the debug mode in the "service.yml" file, the display modes of the comments do not appear in the suggestions. Why ? How to use a ...
0
votes
1answer
24 views

Can I have more than one child content type for a book content type?

I have two content type I selected as book content type: Text_book_type and audio_book_type. Now, I need that these content have different child content type: chapter_type for text_book_type and ...
0
votes
1answer
24 views

How to properly alter a field description in hook form alter

I am altering a field description (help text) based on certain conditions. However, sometimes the description element to alter is set at $element['value']['#description'] = $new_description; And other ...
0
votes
0answers
28 views

Why is node being set to unpublished when edited?

When I create content of any content type in Drupal, I set the status to Published. On editing it, the checkbox that says whether it has been published is unchecked by default and even if I check it ...
0
votes
0answers
13 views

how to create content types dynamically in Drupal 8.5? [duplicate]

I am using Drupal 8.5. I want to create custom content type dynamically through custom form. Like content type name and fields are given in form according to which content type will be created after ...
0
votes
1answer
35 views

Get Current User Last Access Timestamp Per Node in HOOK_preprocess_node()

Drupal 8.x I am trying to compare the current users last access timestamp to other timestamp values and am wondering how to get the current users "last_access" in HOOK_preprocess_node(). MYMODULE....
1
vote
2answers
24 views

Show different fields on node edit and node view depending on the sub-type of the node

I have a specific node type that I want to show/hide different fields in the page layout for both the node form and when viewing the node. For various reasons I don't want to have to create a new/...
-1
votes
0answers
23 views

I cant generate a correctly view on drupal 7 from a values of a field with php

I am a student who has been working with drupal 7 for a website and I can not make the following work. (I will try to explain it as clearly as possible). I have a type of content for example (My ...
0
votes
0answers
47 views

Node body to entity reference revision (paragraph) field not working/processing

I want to migrate the Drupal 7 body of my blog to a Drupal 8 paragraph (field_stories_content which is Entity reference revisions). The body is to be assign to the field_stories_text_formatted field. ...
0
votes
1answer
25 views

Edit field in contentType B when creating or editing node of contentType A

I need to edit a field in contentType B when I create or edit nodes of contentType A. I know it's possible to use rules for this but I need to have more control so I want to do it in my own module. ...
0
votes
0answers
24 views

Is there an existing way to add sidenotes/comments inside the content of a node? [closed]

Is there a way to put inline sidenotes/comments inside a node? A good example is the notes that you can add in Google Docs. That would be great for editorial purposes. Mentors would have a simple ...
1
vote
2answers
55 views

Processing the content generated by a node?

What call would I use to modify a node's content. For example, let's say I have the words "12345678" located in various nodes. If I wanted to replace all occurences of this in Drupal 7 with "abcdefgh",...
0
votes
0answers
12 views

How to get slideshow for a node fields display, having multiple images and multiple videos?

I have a content type having image field and video field,where multiple images and multiple videos can be uploaded. In a node page display,i want to show all images and videos in a slide show. I tried ...
0
votes
1answer
23 views

How to alter the owner/authored by field to the current user when using quick_node_clone

Using Drupal 8 with quick_node_clone module. When a node is cloned I need to change the 'owner' or 'authored by' value to the person who is cloning the node. There is an opportunity of manually ...
0
votes
1answer
22 views

node API hook that can be used to alter fields before loaded by Views?

I need to use a node API hook to alter some node content before it's displayed, in Drupal 7. It just occurred to me though that if I used hook_node_view() it will not effect the output of a View ...
0
votes
1answer
31 views

How to disable redirection to the node after node form submission

I have a node form exposed in the front-end to allow visitors to add their organisation to the list of partners. Below the form, I have exposed view block with the list of existing partners. When a ...
0
votes
1answer
15 views

Change add node select field to show data from 2 different fields of other content type

I didn't know exactly how to ask this but the idea of what I need is very simple. I have content type A with 2 fields: title and A2 Then I have another content type, B, with a node reference field (...
0
votes
0answers
14 views

React/GraphQL - Issues fetching user relationship data

I'm using GatsbyJS, gatsby-source-plugin and Drupal 8. Using http://localhost:8000/___graphql playground, I'm able to successfully query my drupal data. Query : { allUserUser { edges { ...
0
votes
1answer
10 views

On Imported content I am getting the error Text format field is required

I imported some content to a content type on a csv which imported fine but when I went to edit and same the content I get the error Text format field is required. Is there any known way to fix this? ...
1
vote
0answers
14 views

Can Workflow Module be “non-linear”

I have two potential workflows in mind for website content: "Regular" Content Write Article (Draft) Content/Style Review Publish Content "Sensitive" Content Write Article (Draft) Compliance ...
1
vote
1answer
30 views

Can You Use HOOK_node_builder() to Set Custom Node ID?

Drupal 8.x How do you set the node id in HOOK_node_builder()? Is it even possible? There is a similar question here: Specifying a custom node id when creating new content, however it is a different ...
1
vote
2answers
27 views

How to do user relations, and User editing only their content?

Doing Drupal 8.6 is hard (I come from Laravel and Wordpress world). I manage to do by myself OAuth token authentication with Vue, but I stopped on User relations and content-type. I know that where ...
0
votes
1answer
40 views

How to display node details and call function in *.html.twig

I work in D8, I create a custom module first_module. By modules create a url and display all nodes by *.html.twig file. Write code in controller.php public function contentthree() { $connection = ...
0
votes
1answer
15 views

Display node with mixed languages

My nodes, with entity translation enabled, need to be able to handle a node where the content of the node is displayed differently regarding the labels and menus. Let's say I am on a french page, ...
0
votes
1answer
28 views

“Page not found” with new content type

I already have a custom content type (jobs). When I create jobs nodes, they are displayed. I have created a new content type (ideas). When I add an idea node, I get a Page not found error. Any new ...
0
votes
1answer
17 views

Get list of nodes by field-collection value

I am having field_feature as a collection of fields (field-collection) in a content type called 'watches'. Those fields are, field_water_resistance -> water_resistance(Term Reference) field_gender ...
0
votes
0answers
19 views

My custom module does not work with Message Stack [duplicate]

I installed the "Message" module. I want to display the tokens with the reference field of the node. Currently : [message:node-title] is replaced from the title of the parent node, but [message:...
0
votes
1answer
11 views

Possible to have conditional Tokens?

In using URL aliases, is there a way to have conditional token usage? An example of what I'm looking for is: I have programs on my page, each having their own unique program code. By default, say my ...
2
votes
1answer
29 views

Create translated node programmatically

I need to recreate the behavior drupal has when you create a translation but programmatically. Doing $node->addTranslation('de'); on a hook insert create an empty node but I need the field to be ...
0
votes
1answer
48 views

Unable to use Node::load

Fatal error: Class 'EntityInterface' not found in /cptestd8/modules/custom/custom-autofill-reference/custom_autofill_reference.module on line 13 use Drupal\node\Entity\Node; function ...
0
votes
0answers
36 views

Add Adsense code to body

I need to add adsense snippet to nodes body after second or third paragraph. On google are answers for D7, but I need D8. I have tried preprocess_node and preprocess. I have created custom ...
-1
votes
0answers
23 views

How to display the title of the parent node of the comment in Message Stack? [duplicate]

I installed the "Message" module. I want to display the tokens with the reference field of the node. Currently : [message:node-title] is replaced from the title of the parent node, but [message:...
0
votes
0answers
29 views

How to display the title of the parent node of the comment in Message (stack)? [duplicate]

I installed the "Message" module. I want to display the tokens with the reference field of the node. Currently : [message:node-title] is replaced from the title of the parent node, but [message:...
0
votes
1answer
45 views

How to get a count of number of nodes created per week in views and show the week

I am creating a view to breakdown the number of node published per week using views. I were able to create a view that will show me the breakdown day or month but there is no option for week. How will ...
0
votes
1answer
26 views

node_save() null tid column

I am trying to create a node programatically like so, $newNode = (object) NULL; $newNode->type = 'job'; $newNode->title = $data['JobTitle']; $newNode->uid = $user->uid; $newNode->...
1
vote
2answers
60 views

Get the node title conditionally in a view rewrite field [closed]

How can I get the field for the title of the content? In twig I need to do this (for jssor slider) : {% if field_titre_url_externe is not empty %} {{ field_titre_url_externe }} {% else %} {{ ...
0
votes
0answers
23 views

Some nodes can't open anymore after updating migrated content from old databse

I migrated about 34K nodes from a non drupal website. The content was working fine but then my client requested some updates to one of the date fields. So I created a new date field and run the ...
1
vote
1answer
40 views

Unpublished file still downloadable

I have a file attached to a node via a link. The node is published but the file is unpublished. The link on the node points to the file /sites/default/files/file.txt The file is still downloadable by ...
0
votes
0answers
43 views

How to display the title of the parent node of the comment in the Message?

I installed the "Message" module. I want to display the tokens with the reference field of the node. Currently : [message:node-title] is replaced from the title of the parent node, but [message:...
0
votes
1answer
36 views

Showing a message for specific content type

I'm trying to show a message for specific content type through a new module, on Drupal 8.3.0. (I'm a beginner.) This is part of the code I am using. File test_module.module (updated code, still not ...
1
vote
3answers
53 views

hook_node_view_alter not working

I'm hoping to finally find some solutions here. I'm new to custom module development in Drupal and I'm trying to learn the basics. What I'm trying to do is use hook_node_view_alter, however even at ...
0
votes
1answer
52 views

Why doesn't the token for the node title work?

In Drupal 8, I activated the Message module and the Message Example sub-module. These are the fields I added to the template to create a message when a new comment is created. This is the ...
2
votes
1answer
18 views

Are the revision settings on a content type respected when the content is changed programatically?

I want to practice making some bulk updates via code, but I also want the option of reverting back to an earlier versions in case some of the changes are incorrect. Are the revision settings ...
0
votes
1answer
17 views

Autosave nodes, when editing or creating new ones, in database

Looking for a way to actually save nodes every x seconds when creating or editing. I am aware of the Autosave module, which is a great module but it only saves the forms on clientside and has quite ...
3
votes
1answer
34 views

Only render translated nodes, prevent rendering of base language node

Having an entity reference, Drupal 8 automatically renders the base language of a referenced entity if it isn't translated yet. Is there a way to globally prevent that? So if there is ContentType1 ...
2
votes
2answers
64 views

How do I check if a user has view access to a node, in a template file?

I'm currently working on a simple LMS in D8 and have already defined the fundamental content types. Among them is a content type called Course, which can be considered "Premium" content, i.e. all ...
0
votes
1answer
31 views

Owl Carousel does not respect Image Styles as set in node display in custom node file

I am trying to get owl carousel to respect the image style declared in the manage display setting for the content type. The code I used to output in the node is: <div class="owl-carousel owl-theme ...
0
votes
1answer
25 views

How to hide certain content types from a Link field

I created a content type for my slides in a carousel. I make a view to print them all and everything works perfectly. My only problem is that I have multiple use of the Link field from core and the ...
0
votes
1answer
24 views

How to remove text from browser title?

I'm looking for a way to change the text ' | Drupal' part from the tag for all pages to ' | ToAnyThing'. I guess it should be possible to achieve this in the admin interface somewhere, but I cannot ...