Drupal questions and answers

Drupal

How do I automatically do an SQL insert when creating a new node?

When creating a new node of a certain type, I want an SQL insert to be made at the same time. The insert operation needs to use the node ID from the node just created, such as INSERT INTO my_own_db (nid) VALUES ('last inserted node id'). ....

Grace Grace: 13 minutes ago

Drupal

How to add javascript with #attached in a node which contains a specific paragraph bundle

I need to attach js in all nodes with a specif paragraph bundle. I know how to do this with drupal_add_js, but I prefer don't use it to prevent cache problems. I am trying with hook preprocess_entity but I don't get it, I don't know how to use the function ....

Theo Theo: 46 minutes ago

Drupal

Assign field permission to individual users?

Here the idea is to avoid defining dozens of roles to account for delicate permission requirements of users. Say, on a certain node that has 100 fields, a webmaster may eventually need to define several hundreds of permission sets, many of them are needed for very few users on and ....

David David: 1 hour ago

Drupal

can't change the value of ONE button (search page SEARCH button)

I have succesfully changed the search button text of the block but can't seem to get to do this on the search page on the following form_alter both forms enter it and are set but only search_block_form gets affected function MODULE_NAME_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) { if(in_array($form_id,)) { $form = "Custom ....

Silas Silas: 1 hour ago

Drupal

Javascript running twice when not logged in

I have this issue that any custom js (added into theme.info file) script file is runned twice. However, I noticed that it will be runned only once if I am logged in. This happens in Drupal 7. What is the cause? The js script is a clear only having alert("Entered ....

Emilia Emilia: 1 hour ago

Drupal

I can't backup my website on a shared server because memory runs out. What can I do?

I have a large Drupal7 website on a shared Hostgator server, and I cannot do automated backups because I always run out of resources. I've tried 2 methods: 1) I first built my own CLI bash file and I set up a cron job to execute it every night. The ....

Chloe Chloe: 1 hour ago

Drupal

How to use Views PHP to code if a view exists and has content then echo...

I have a view displaying a list a menu of all the content for a node. It contains a list of all the fields and views on the page, with the output rewritten as a link eg link to field A . I can do this fine for each field ....

Eleanor Eleanor: 1 hour ago

Drupal

How to create a PHP file that returns a list of nodes as XML?

How do I create a PHP file that returns a list of nodes as XML when called if I have a menu structure like this: <GalleryXML> --gallery 1 ---Item 1 ---Item 2 ---Item 3 And I want a url like localhost/getgallery.php this url will then return my gallery as xml, ....

Andrew Andrew: 2 hours ago

Drupal

Autopublish content from drupal to wordpress

My question is that i am having a drupal blog and wordpress on different different domains. I am looking for a module so that whenever i publish some content in drupal it should also published in wordpress. ....

Elizabeth Elizabeth: 2 hours ago

Drupal

How to prevent a field with thousands of files from loading on Edit operation?

I have a process running that renders a PDF to PNGs and attaches those PNGs to a file field. There is one PDF's results per node, but there we have a bunch of PDFs with 10,000+ pages. We've found that this results in the operation of loading an edit form ....

Ivy Ivy: 2 hours ago