Questions tagged [nodes]

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

Filter by
Sorted by
Tagged with
7
votes
3answers
21k views

How do I define a template file for a specific node ID?

I'm trying to define a custom template file for a specific node, using the node ID. I read a lot of topics saying to create a node--X.tpl.php file in the templates folder. That's what I did; ...
3
votes
1answer
4k views

Override theme template from module without implementing a theme

I have a project on D8 where I don't use any custom themes, I use default seven theme for everything because there is no need of any visual theming. So My question: Is it possible to override theme ...
2
votes
1answer
598 views

How to revoke edit access to the node's author after publishing a node?

I am trying to build a new rule on Drupal 7 with both the Rules and Content Access modules (and its sub module Content Access Rules integration). Thus, I get new actions like "grant or revoke an ...
1
vote
2answers
2k views

How to show the content of a group on the group page when using the Group module?

Using the Group module, you can create a group, say 'group ABC', and create or update some nodes so that they belong to that group. But when you visit the "Group ABC" page, you don't see those nodes. ...
3
votes
1answer
825 views

Update a field without changing the node

I need to change a field in a node without altering the 'changed' timestamp. I know this was possible in Drupal 7 using field_attach_update(), but that has been removed since then. I could use an ...
1
vote
2answers
83 views

How to grant userpoints only for modifying nodes last changed at least 20 days ago?

I am not sure how to go about this. I use the Userpoints module in Drupal 7 to attribute points to users who create nodes ('reviews'). I also want to allow them to gain some points if they supersede ...
40
votes
11answers
28k views

How to display a field before node title?

I'm looking to render a certain field before the node's title when displaying a teaser in D7. Effectively I want to go from this to this. I have looked into updating the node.tpl.php but I notice ...
22
votes
14answers
12k views

How do I hide the default page /node?

Drupal out of the box comes with a page (which is the default homepage) that is assigned to the node path. How do I avoid users reach it, and redirect them to the actual homepage of the site?
22
votes
7answers
16k views

How to programmatically set the front page?

I want to set the Drupal front page programmatically at run time. How can I do this? Is this possible?
19
votes
7answers
21k views

How to copy content type?

How to copy content type in Drupal 7 ? I can't find a button to duplicate content type.
14
votes
4answers
3k views

Delete a node after X weeks it was created

How can I delete a node after, for example, 2 weeks it has been created?
20
votes
5answers
23k views

Programmatically updating a node

I can create a node using the following code: $node = \Drupal::entityTypeManager()->getStorage('node')->create($array); But if I have the node ID, how can I edit a node?
3
votes
5answers
12k views

Sync content between two Drupal sites

I have two Drupal 7 sites running a very similar structure (views, content types, etc) but with a different theme and a few other changes. I need to have all the nodes of specific content types that ...
17
votes
8answers
9k views

“View unpublished content” permission for non-author

I googled a bit to see if there's a permission-level way to allow a logged-in (but non-admin) user see unpublished content (marked with the CSS node-unpublished class). This appears to be scheduled ...
11
votes
9answers
10k views

Views slideshow from single node

I'm trying to achieve working slideshow from images in single node. Images are uploaded from the image field. It's drupal 7. I made new content type and all I made now is slideshow from multiple nodes ...
10
votes
6answers
8k views

Disable vertical tabs by content type or user role

Some users may only have the ability to edit one of the fieldsets that shows up in vertical tabs on the node edit form. In such a case it looks rather silly to be using vertical tabs since there is ...
7
votes
6answers
3k views

How to hide the content of nodes/ completely, and still maintain use within Drupal?

So, to start off, I've seen: How do I hide nodes that shouldn't be directly accessed from users and search engines? How to prevent access to Views-only content? How can I restrict view pemissions ...
4
votes
1answer
3k views

How to create a node programatically with drupal_form_submit()?

How to create a node by programatically submitting the existing node add form, and most importantly using it's validation process instead of re-implementing all of the property/field validation logic ...
4
votes
5answers
4k views

How can I use 'xx time ago' as date format?

How can I use 'xx time ago' for date format in Drupal 8 nodes ? I want to replace "xx time ago" with {{ date }} in node. In Drupal 7 it worked with this code : <?php print format_interval(time()...
18
votes
4answers
17k views

How do I remove the “submitted by” text on node display?

In Drupal 6 the option to remove that text was located in the theme settings; where is it in Drupal 7?
16
votes
3answers
22k views

What hook can I use for post-save actions?

I've found several posts with this same question, but the answers always diverge to some other topic or they don't work for my needs. After a node is saved, I want my custom module to insert a row ...
9
votes
3answers
13k views

How to create nodes using node_save?

I'm trying to migrate my current html site into Drupal. I have over 80,000 pages I have to migrate so I thought instead of sitting in front of a computer for 50 years I would create a module. I was ...
8
votes
3answers
8k views

How can I embed a View inside a content of a node?

How can I embed a view inside a content of a node in Drupal 8? I found something similar, for example in the question about "How do I embed a view inside a node?" or the Viewfield module, but it is ...
7
votes
4answers
6k views

How do I make a block that pulls the current node content?

Ok, so I know blocks in Drupal 8 have these things called "contexts" which allow Core to clear cache on a fine-grained basis. I can't find any decent explanation of how they work, or how to get page ...
7
votes
3answers
829 views

Use email to validate post, not unlike craigslist

I'd like for anonymous users to be able to post nodes to my site. By default their post is unpublished, but when they submit it, the site sends an email with a verification URL. When they revisit the ...
3
votes
1answer
2k views

Multiple nodes in one slide using views slideshow or another module

I have a slideshow using views_slideshow which displays the latest post from 4 different content types, I need the slide to show multiple contents (from different content types) in one slide, when you ...
2
votes
1answer
3k views

Programmatically get the list of fields of a custom content

I want to programmatically create a custom content (custom content created via the admin UI). Before the creation, I want to check the types of fields of my custom content. My custom content contains ...
15
votes
1answer
12k views

How to integrate Field collection module in Views?

I have created fields and grouped together with Field collection module. I have attached the group field (containing 4 fields), to user account settings in : admin/config/people/accounts/fields. Now ...
8
votes
4answers
2k views

Finding all nodes not referenced by a menu entry or another node

In the course of creating the content for a site, we've ended up with orphaned content nodes that are not linked to from anywhere. I'd like to find and examine these. Surprisingly, I can't find a ...
8
votes
1answer
14k views

Changing the registration form

I would like to revise the default new user registration form in Drupal 7. Rather than to requst "username", I want to request "full name" with helper instructions to enter the text "username is your ...
6
votes
1answer
329 views

How do I model content (types) from a database-centric point of view?

How can I model content from a "database-centric" point of view? For example to show Appartments in a District in a City, as in this example: Table Cities: CityID (int) primary key City (string) ...
3
votes
3answers
5k views

Programmatically adding fields to node submission form

I need to add fields to a node creation/editing form programmatically. More specifically, I need to take already-generated form elements from another form and insert them into the node submission form....
2
votes
5answers
7k views

Move title display below other fields

When viewing a node, I'd like the Title to display below one of the other fields in the Content Type, but it's not available to arrange in the Manage Display tab. With all of the flexibility and ...
12
votes
4answers
5k views

How to delete a content type, programmatically?

I programmatically created a content type during a module installation (using field storage configuration). I want to delete that content type while uninstalling the module. Is there any way to do ...
12
votes
2answers
2k views

Reorder Content Types in (“/node/add”)

Is there a way to reorder the content types shown on node/add?
5
votes
5answers
624 views

How to grant userpoints to users who perform a login 5 days consecutively?

I need to know if a user has performed a login, for example, 5 days consecutively. The reason for this is I want to award User points to them. For example: User A performs a login on Monday, ...
4
votes
4answers
8k views

Create content types containing other content-types

I've created a custom content-type called "Books." I need to create another content type named "Catalogs" which may contain one/many "Books" as its fields. How would I achieve that? I'd prefer some ...
3
votes
5answers
3k views

Hide user's blog link on blog entries

I want to hide the user's blog link that appears on blog entries e.g Anonymous's blog How can I do this in node--blog.tpl.php? I tried hide($content['author']); but that doesn't seem to work.
3
votes
1answer
2k views

Rename “Read More”

I wanted to rename "Read more" in teaser (node--blog--teaser.html.twig) to something like "Continue" or anything else. How can I achieve this?
2
votes
5answers
12k views

How to count the number of unique views of a node?

Is there any possible way to find the number of views of a node. For example: I have created a node called "Sample". If i viewed it once then the count should be increased as 1 view and when i view ...
0
votes
1answer
806 views

How to change the text format of the body field of 200 nodes at once?

I need to change the Text format of the body field of 200 node of the "flats" content type. I guess I can do it in the database but I don't know where to look.
3
votes
0answers
4k views

Node reference field in a webform [duplicate]

Are there any modules available or any procedures available so that node reference fields can be incorporated into a webform?
2
votes
2answers
1k views

drupal 7 + services 3 - inserting nodes with select fields

I'm using Drupal 7 + Services 3 to create nodes with POST and JSON. Everything works fine, except field types of select - entity reference select or plain text. The entity reference uses the ...
1
vote
2answers
84 views

How to check with Rules if a new element has been added to a list in a node?

I'm using the Rules module and I would like to make a rule to check wheter a new element has been added to a list in a node. First I have tried "List Count comparison" but it can only compare a list ...
1
vote
4answers
1k views

Get payment before users create a node

When users create a node, they should be redirected to a payment page; if payment is successful, the user can see the node. Is there any way to achieve this?
0
votes
1answer
267 views

Drag and drop nodes in a node list (to later use that sorting inside a view) [closed]

Under example.com/en/admin/content I show all site content filtered by content type and then I get a list of all nodes from that content type. The nodes will appear in some sorting (usually date). ...
0
votes
4answers
66 views

Restrict node to be shown only in a view and not by its url?

I created a node which has an entity reference to select a user. Then, I created a view to show the node only to the user referenced in the node. This works fine, but the problem is that the node can ...
31
votes
6answers
31k views

How to load a node based on its title?

I only know the title of a node, and I want to load the node using node_load(). How do I do that?
23
votes
5answers
8k views

Unable to delete feature content type after uninstalling feature

Issue Uninstalling a feature which creates a content type hides the "Delete" link on the admin/structure/types. Issue on Drupal.org
13
votes
1answer
12k views

Export content types using features [closed]

I am struggling with it, but I can't do it by myself. Google doesn't gave me links for tutorials other modules doesn't help me too. I would like to export content types definition from Drupal site to ...

1 2 3 4 5 14