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

Edit existing 'if' condition to add a class to a div and display / hide divs

I am using a template which has an 'if' argument to alter the output of a div containing an image field. I need to add my own condition (within comments) to it. Currently the output is creating the ...
1
vote
1answer
385 views

Change Log in or register to post comments for content type

We are using the comments for a particular content type to post reviews for that content type. I have searched the web but can't find a proper solution how to change the text "Log in or Register to ...
-3
votes
0answers
99 views
+500

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

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"). With Drupal, such program ...
0
votes
2answers
331 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
333 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 = ...
5
votes
4answers
3k views

How do I prevent a Node from being deleted?

I want to make some checks and, under certain circumstances, prevent a node from being deleted. My module makes checks in HOOK_form_BASE_FORM_ID_alter() when the node is being created, but I cannot ...
0
votes
1answer
387 views

Get array length of a multiple fields of a node content type

I'm developing a site with Drupal 8. I made a custom content type, with a lot of fields; in particular I have a field called field_categoria_del_libro_presen that is linked to a taxonomy term. It's ...
1
vote
2answers
367 views

Mapping existing file against a new content type

I am facing a situation here. I have a content type A with an image field(field_upload_snaps) in it. There is another content type B which also contains an image field(field_valid_snaps). Now user ...
1
vote
1answer
333 views

Blog monthly archive block - list of posts grouped by year then month

See the implementation on this guy's blog: http://deglos.com/blog YEAR -- Month -- Month YEAR -- Month -- Month Anyone know how this was accomplished?
5
votes
1answer
329 views

Replacing tokens in Newsletter

I'm trying to create a custom template using the Drupal Newsletter module. I need to populate the newsletter with existing content. For this, I think I need to replace a token like [node:nid] in the ...
0
votes
1answer
27 views

How to display since when the node was created?

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
11 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
429 views

showing translation of the related node in view

I have a node type called Match. Each match have two entity reference fields that points to two nodes that has the type of Team. I built a view and use the relationship to show the matches and the ...
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 ...
2
votes
2answers
428 views

Calendar From Multiple Content Types

I have a 4 seperate calendars created on drupal; each with their own content type. Each of these need to be able to be viewed on their own but I'd also like to be able to combine all of these ...
14
votes
2answers
8k views

How to get the human readable content type name in a node template

I have created node template for my node, and its working fine. I need to print content type name, which is like "Whitepaper" and has machine name "w1" in my node template. If I use variable {{ node....
2
votes
2answers
355 views

Preview different then output in views

I'm a newbie in drupal. So I have this view which Im saving as a block and the way it displays in the preview of the view and on the page is different. Any ideas? If you have any questions about my ...
0
votes
2answers
57 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
0answers
30 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 ...
0
votes
1answer
601 views

How to get view name and display ID in template_preprocess_node function

I'm having some trouble in order to get a view's name and the display ID in a template_preprocess_node function. I have a custom content type and a view with two different displays. My idea is to ...
1
vote
2answers
599 views

How to set and inherit variables within different twig templates?

I'd like to set a variable in my node.html.twig template: {% set title = label %} {{ content }} The content consists of one field visible only, which has it's own template: file-link.html.twig How ...
0
votes
1answer
526 views

Why is hook_form_alter() not setting default values in _after_build function on /node/add/myct?

I've got a validation form (id="mymodule-myct-verify-form") that retrieves data from temp_node to populate it's hidden fields. On submit, the form sends its data to /node/add/myct. (currently via $...
3
votes
4answers
2k views

How do I check if the form is an add/edit/delete form?

I need to check if the form is for creating, editing, or deleting a node. Currently, the below snippet allows me to check if the form is for adding or editing a node. How do I check if the form is ...
0
votes
1answer
371 views

Templates and hooks by Universally Unique IDentifier (UUID)

I'm looking for a solution to migrate content between environments (dev->staging->production) and currently I think I'll use UUID and Node Export (as far as I see UUID Features is still in alpha and ...
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 ...
2
votes
1answer
360 views

Records with identical uid and timestamp in node_revision

I'm investigating an issue on a D7 site where a handful of node revisions have apparently gone missing. The issue was discovered on 3/5, and I just noticed in my node_revision table that several ...
0
votes
1answer
367 views

Change the size of the form element for content title

I could have sworn that when we created our content type, we could select the size of the textfield for the title. I am unable to find that now as I'm in "Manage Fields" and the edit link that's ...
1
vote
2answers
330 views

Taxonomy term missing as type of data to store in new field for content type

I have Drupal 6.2. I added a taxonomy term and I am trying to to add it as a new field to a content type. However, I don't see "taxonomy term" as a "type of data to store" when I try to select a field ...
-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
331 views

give permission of create new revision to specific roles

I need to give the permission of "create new revision" to a specific role. but nothing related to this issue appeares in permissions page! I've installed Revisioning module too. how can I set it?
2
votes
1answer
373 views

Use Book different order than weight and title

I am wondering how to change the default order of weight, title for Book in Drupal 6. I have a set of nodes displayed inside a page that use a estructured book. The problem is that i want to display ...
3
votes
1answer
362 views

How to pull pictures and summary information from external web pages when posting links?

When posting a link (external web page) to my Drupal blog, is there a way to have Drupal automatically pull the picture and summary information from that link and include it in the post on my Drupal ...
0
votes
2answers
381 views

Updating node field value using custom module validation

I currently have a custom module which calls a submit custom validation function. I am trying to update a value after the validation is run. Basically, if a value is present, update a field to say "...
0
votes
4answers
346 views

Create two nodes with url aliases on one submission

I have a content type "News". With URL aliases pattern and token the URL is like this: news/[node:title]. Is it possible to create two nodes on one submission with different URL aliases? Let's say on ...
2
votes
1answer
50 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
596 views

Save node via ajax continuously

I'm trying to save a node (with the normal node form) via an ajax callback. The first save works. But after that I want to return the same node form again so that the user can update the values and ...
5
votes
3answers
2k views

What is the purpose of using node_submit() before node_save()?

I am creating a node programmatically , In the code given in the link http://timonweb.com/how-programmatically-create-nodes-comments-and-taxonomies-drupal-7 after creating a node, the code goes as ...
2
votes
1answer
351 views

Is there any alternative of node_save to update database fields in iteration?

In Drupal 7, we have big product catalog where we need to update price and stock frequently via Cronjobs. If we update only 5000 prices then also it takes around 20 min. In each iteration we use ...
1
vote
1answer
32 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 ...
0
votes
2answers
627 views

How do I resolve missing content type references from uninstalled modules?

In my previous setup of my site, I installed a bunch of modules and had them uninstalled. But now I have many orphaned or missing content types that still resides in the database somewhere. Below is ...
1
vote
1answer
381 views

How do I set the options for a programatically created content type?

For example, if I want to set 'Publishing options - Promoted to front page' to 0 in a .install file when creating a new content type. I've looked in the variable table, where I was expecting to see ...
1
vote
2answers
374 views

Field available only when a value from a Hierarchical Select is chosen

I am using a Hierarchical Select that enables a user to first select a continent ( first select ) and then a country ( second select ) I wish however to enable a field ( text ) only when a user ...
1
vote
2answers
405 views

How to set node creation limit by user type in Drupal

I'm trying to set the limit on authenticated user for creating particular type of content(adding user limit on content type). Node limit module has same functionality in Drupal 7 but i'm looking for ...
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) ...
2
votes
1answer
358 views

Referencing nodes reciprocally

I have a content type called Project which can relate to n projects of the same content type. This is done with a field called related projects using the D8 core Entity References. A possible ...
31
votes
17answers
32k views

How to delete all nodes of a given content type?

I have several thousand nodes of a particular content type. Using the web interface (example.com/admin/content), I can only delete about 50 at a time. How can I quickly delete them?
1
vote
2answers
939 views

Set a boolean (single on/off checkbox) value while creating a node

I am creating a node (in Drupal 8) with the following code. use \Drupal\node\Entity\Node; $node = Node::create([ 'type' => 'calendar_data', 'title' => 'testing finaly ...
0
votes
1answer
329 views

content type field not printing

In drupal 7, I defined a field for a custom content type and am trying to display its value via page.tpl.php. Nothing is appearing in the rendered page. Here's the relevant piece of page.tpl.php. ...
0
votes
1answer
409 views

Internal server error on node save

I'm getting internal server error on node save. In db log messages there is no such error regarding this issue. In apache error log I have these messages mod_fcgid: read data timeout in 40 seconds, ...
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 ...