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
117 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
51 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
30 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
35 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
118 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
52 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
31 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
34 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
45 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
50 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
99 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
19 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
31 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. ...
0
votes
0answers
45 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 ...
0
votes
1answer
266 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 ...
0
votes
0answers
29 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
58 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
17 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 ...
0
votes
1answer
35 views

Filter a view with contextual authored date

I have a Drupal 8 view where I want to sort nodes by authored year using contextual filters. So www.mysite.com/2017 will list all nodes from 2017. I set up the filter using 'Content: Created Year' ...
0
votes
1answer
30 views

Link module output with content type

I am confused on how to output links from a content type into a list in HTML. Currently I have the following code. <div class="lenders-block-content clearfix"> <ul> <?...
0
votes
1answer
26 views

How to join the `field_data_field_*` tables with `node` table using SQL?

I apologize if I ask for something obvious, but I am asking because I could not find a simple answer anywhere. I know how to work with these tables in the PHP Drupal code, which built-in functions to ...
0
votes
0answers
33 views

Create custom webform when creating node?

I’m trying to find out if it’s possible to create webforms when creating nodes or paragraphs. I mean instead of choosing a predefined webform, then build it right inside the field. I figured that ...
4
votes
1answer
268 views

How to disable creation of node revisions on programmatic node update?

I added a field of type computed field to existing nodes. It's required to re-save the nodes to set/update computed field values. As I do not want to update the changed timestamp I decided to not use ...
0
votes
0answers
27 views

Node::access with anonymous user

I want to add a CSS class in hook_preprocess_html(), which indicates that logged-in users have access to the content and that anonymous users don't have access to it. First I get the node with $node ...
0
votes
1answer
29 views

How to use hook_views to add calculation to a field?

In a custom module (assoc), I have a custom Content Entity (Person) with these fields: $fields['lastname'] = BaseFieldDefinition::create('string') $fields['firstname'] = BaseFieldDefinition::create('...
0
votes
3answers
64 views

Menu tree from taxonomy terms and nodes which belong to them

i need to create a collapsible menu tree from taxonomy terms and nodes which belong to them (not nested terms, but content pages) i'm totally stuck about it i've found solutions for nested taxonomy ...
0
votes
0answers
45 views

Check if a user has already created a node and redirect the user when the node exists

I am trying to redirect users to a page when they have already created a node in mytheme.theme, in order to prevent a user to create a node twice. function mytheme_node_prepare($node) { if ($node-&...
0
votes
0answers
17 views

Override imported data on node creation

I would like to transform some data I am getting from an RSS feed. I get a set of items and create nodes using the data I get, so far so good. However, some of the data fields contain relative URLs, ...
0
votes
1answer
14 views

Node Export being downloaded as a .sh file and unable to be imported

In my Drupal 7 project, I have some content of a custom content-type (page) that I need to import into another environment. When I go to this content instance, I select on Node Export, which then ...
-2
votes
1answer
33 views

Creating a displayable 'index' of content nodes within a path

Ok, it's been over a decade since I've worked with Drupal (primary use was for a personal blogging platform, with a bit of extra extensibility and a well developed plugin ecosystem). Sadly, most of my ...
0
votes
0answers
44 views

Drupal 8 uploaded should be stored in certain s3 bucket

Currently, I'm facing an issue while uploading a file. I'm fetching the file tid with hook_entity_presave: $file_tid = $entity->get('field_photos_photos') ->getValue()[0]['target_id']; if(!...
0
votes
1answer
29 views

Unable to access translated node content

After performing a Drupal core update on my site today I've found that I can no longer access translated content. When I try to view or edit the translation, I only see the default language content. ...
0
votes
1answer
22 views

How to validate field in inline entity form referenced field

I have created field "Referenced" which is entity reference field of other content type. Also this field have inline entity form functionality means its giving two button "add new node" and "and ...
0
votes
2answers
510 views

AJAX callback inside hook_form_alter()

I don't know how to implement AJAX callback in hook_form_alter(). The field is plain text by default and it is populated by NID (number) of the client company. The module name is "my_car". I didn't ...
0
votes
1answer
15 views

Excluding inline images in views

I have a node type with an image field and insert button to get the image into the text field. Then there is a view that is getting the content of the text field and shortening it to 150 characters. ...
0
votes
0answers
66 views

Render content type display mode in custom module [duplicate]

I'm facing the issue with rendering content type in specified display mode (teaser) in my custom module. I have a module which stores NIDs in session, and when user enters specific page, I want to ...
1
vote
0answers
28 views

behavior of path on unpublished/draft nodes

We have a Drupal 8 site with a press releases page. Currently the press releases page is provided by a view with a page display. The path in the page display is set to /press-releases. I've been ...
0
votes
1answer
36 views

How to print the URL of a title field?

I'm trying to print out the url path from the title in my twig template however I haven't been successful so far. Printing out the title containing the link works fine using: {{content.title}} ...
1
vote
1answer
61 views

How to use hook_prepare to modify a field of a node before it is edited

I want to modify the contents of a field of an Article node just before it comes up for editing. I have read the documentation at http://api.hostdog.gr/api/drupal-8/drupal%21core%21modules%21node%...
0
votes
1answer
185 views

Custom Page routing

I created a custom page type called 'Angular page' and a custom twig template for it which loads my angular scripts and prints the <app-root> tag. I set the page URL to /angularpage and the ...
0
votes
1answer
68 views

REST Export Views and images alternative text

I have a simple REST export View. The View format is set to "Show: Entity". The content type I am exporting contains a standard image field. My image field settings is set to "Enable Alt field" and "...
0
votes
0answers
26 views

How to get referenced entity fields from another content type in single node template [duplicate]

I have a content type called "Resources", this is referenced from another content type called "Projects". I can get simple text fields in my single node--project.html template for example - {{...
0
votes
2answers
354 views

How do I pass a value to a content type field with a custom submit please

and thank you for your patience in helping me learn I have created a content type called response (Through Drupal, not in a custom module) In the content type I have a field called ...