Hooks are PHP functions used to interact with the Drupal API.

learn more… | top users | synonyms (1)

-2
votes
0answers
13 views

How to put image under div in hook_field_formatter_view in drupal 7? [duplicate]

I am using this code in my custom module .. This is not showing image only showing div. function mymod_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) { ...
0
votes
0answers
7 views

Choosing an image field's format or width/height using template_preprocess_field

I'm using this function to get a custom user field in node.tpl: function MYTHEME_preprocess_node(&$vars) { $node = $vars['node']; $user = user_load($node->uid); $logo_var = ...
0
votes
0answers
4 views

How to add metatag module data to the Search API indexes

I am in the process of building a new site that will have some content in the form of videos and PDFs. To make those more searchable I added the metatag module. We are also using the Search API to ...
0
votes
1answer
10 views

Getting the field of a user based on uid or name

I'm trying to display some custom user fields of an author, of a content type's nodes. The only fields in $node that relate to the author seem to be $node->name and $node->uid. I tried this in ...
0
votes
1answer
22 views

how to add wrapper div for a image via image formatter in drupal 7?

I am creating custom formatter for images using hook_field_formatter_settings_form() in drupal 7.. I need to add wrapper div for my custom formatter. Means when I select this formatter then image ...
0
votes
0answers
7 views

Add a new country to location module in drupal 6

I need to add a new country to location module country list. I do not want to do it by changing in database. I can see there is a hook for the same in D7. <?php function ...
2
votes
1answer
34 views

hook_form_alter based on path

I don't know if this is possible but could I do something like <?php $foo = current_path(); print $foo; ?> in page--foo.tpl, then something like function ...
1
vote
5answers
92 views

How to get the $form_state in hook form submit?

I need to create a node when a comment is submitted in nodes. There are two content types image and memory and I need to get node ID of the node that a user is inserting comment in it. Here is my ...
1
vote
0answers
33 views

Paragraphs Module alter form field

Using the Paragraphs module in Drupal 8, I am attempting to alter the behaviour of the form fields contained within the paragraph field. This is so I can add behaviour like ajax callbacks, hide show ...
0
votes
1answer
13 views

drupal 8-b12: how to assign variables from FormatterBase-Interface to _page_attachments hook?

I have created new field-types in drupal. Therefore I have an Instance of FormatterBase, which gets the values from the database and tries to render the values. but i want to pass the variables ...
0
votes
1answer
20 views

Add an attribute to a specific tag in text body of page

I would like to add an attribute to a specific tag in the text body of a page. I was thinking in this direction: add MYTHEME_preprocess_field(&$variables) to template.php apply regular ...
3
votes
2answers
101 views

revoke access of author to flags

I have a workflow system for my nodes, one of the states is "Disable". also there are some flags on those nodes as well, I'd like to know if there's a way to revoke access of author to use flags when ...
0
votes
0answers
10 views

Quick search view submitting to full search view?

I've got a filter view in Drupal 8 that allows me to filter a specific content type by various taxonomies, dates and titles. I also need a 'quick search' view in the header which has the same ...
0
votes
2answers
15 views

how to uninstall custom database table in drupal 6

I want to create custom table for my custom module "custom_module_table" /** * Implements hook_install(). */ function custom_module_install() { drupal_install_schema('custom_module'); } ...
3
votes
2answers
70 views

How to print edit link on a node page if the current logged-in user has access to node edit

I'm using Display Suite custom fields to have my Edit link rendered somewhere else on the node page, I'd like to see if there's an easy way to check if the current user has the permission to edit the ...
0
votes
1answer
20 views

Calling another function using drupal_get_form

How can I call a function using drupal_get_form when a submit button is clicked. My situation is that i have a custom module where there is only a submit button. So when that submit button is clicked ...
0
votes
0answers
2 views

Get $form_state backup and migrate filter extended class

I have form altered the backup and migrate quick backup screen (admin/config/system/backup_migrate) and added a text field. I'd like to use the value of the field to create a new node just before the ...
-1
votes
1answer
10 views

Hide zip in addressfield form on commerce checkout pane?

How can I hide some fields from addressfield module (for example zip code) on checkout process if certain country is selected? E.G. If US country selected then hide postal code field. If CA country ...
0
votes
0answers
9 views

Drupal handle and process POST request webhook from activecampaign

I'm trying to make a small Drupal project with ActiveCampaign. I already implemented the activecampaign webform and it works but what I want to do is use the webhooks that activecampaingn can offer ...
-1
votes
2answers
36 views

Other modules functions

Is it possible to have a function call within one module which calls a function of a different module even if that function has not been defined as a hook?
0
votes
0answers
7 views

Drupal 6 uc_discounts expiry notification

I would need to trigger a function when a discount defined in uc_discounts expires. Is there any hook or other way to handle this?
1
vote
2answers
13 views

Associate webform submissions with the user created

I am allowing anonymous user create submissions, and creating a user programmatically based on these submissions. How do I associate this submission with the user I've just created? UPDATE: I thought ...
0
votes
1answer
18 views

Get Order Object on Checkout Complete Page (Ubercart - Drupal 6)

I'm trying to develop a new module but just can't get the correct solution, I hope you can help me. On the checkout complete page i need the order object with all information of the just created ...
0
votes
0answers
8 views

wallet or favourite page redirecting

I am stuck in mid of a coupon website where I have to share the coupon to the user favorite page. please help me to know the process on how could I share the full coupon block to the favorite page ...
3
votes
3answers
340 views

What are hooks and can I learn the Drupal Hooks issue if I've yet to learn PHP? [duplicate]

Whenever I try to read about what are Hooks in Drupal, and how to manipulate forms or content with them, the text seem not to deal with the UI at all, but mostly with coding... Maybe I did not ...
2
votes
1answer
31 views

Prevent drupal from adding a favicon from default directory in custom theme

I want Drupal to look for a favicon in a specific directory dynamically. This is mainly because I'm using the domain access module and I'd like the favicon based off the subdomain that is being used. ...
0
votes
0answers
4 views

Can we use Deployment Module with multi DB Drupal Site or Cross DB Connection Drupal Site?

I have scenario in which I am using Cross DB connection on my Drupal 7 Site, I specified my DB connection in settings.php file. Second DB is used as a source db. Can I use Deployment Module to deploy ...
0
votes
0answers
16 views

Undocumented API

I need to learn how to use an API which is provided by a Drupal module through custom hooks. The module is CMIS API https://www.drupal.org/project/cmis The module provides no tutorial, ...
1
vote
1answer
23 views

Make Wysiwyg Use CKEditor CDN

Is it possible to make the Wysiwyg module use the CKEditor's CDN for delivering the editor to the browser client?
0
votes
2answers
34 views

Move “Submitted By” from node.tpl to page.tpl

I'm looking to move "Submitted By" info from node.tpl to page.tpl however when I add the following from node.tpl into page.tpl I get errors. Im assuming I dont have access to those variables, but ...
2
votes
3answers
85 views

pass argument as a wildcard to node/add/Article/560012

Case : I do have a Article-share content type , it does contain a node reference to type "Article" , now this is my scenario : user selects a node of type Article he redirects to node/add/Article ...
1
vote
2answers
35 views

What is the order of execution and redering of hooks and page components? [closed]

In order to have a better understanding of what Drupal does, I need to find out what the order of execution of hooks and page components is. A page layout in Drupal consists of HTML, regions, nodes, ...
0
votes
1answer
34 views

Catch the selection of the values in select/drop-down-box prior to the node submission

I have a Drupal 7 custom module with a couple of select/drop-down-boxes. Is there a hook to catch the selection of the values in those boxes prior to the submission of the content node? I am looking ...
0
votes
1answer
48 views

How to override a node

I have created node there path is "content/book/book-name-alias". Where I have override a node using view page "content/book/%" where contextual filter using "Node Id" When i have request a page ...
0
votes
1answer
23 views

How do I get $form_state from hook_entity_update()?

I've manipulated the edit node form via hook_form_BASE_FORM_ID_alter() to insert a select pull-down menu. In my module, I've implemented hook_entity_update() to fire when the edit node form is ...
0
votes
2answers
35 views

Bootstrap search form wrapper alter

I am using the 7.x-3.0 version of Bootstrap and have sub themed it. I want to change wrapped div, add 'input-group-sm' to the class bit I can't not figure out how to override it. if I add ...
1
vote
1answer
17 views

How to show registration page in another language in Drupal 7, maintaining its natural behaviour?

I need to show my registration page in another language, keeping this separate from his natural behaviour. In particular this page must be showed in English on the page of the site it owns to, but i ...
0
votes
0answers
12 views

How i can add folder in filedepot using a custom module (without rules)

I want to create a module that adds a FileDepot folder, in this module I want the user chooses a name for the folder and I want the Parent Folder will by default "Top Level Root", I began to create ...
0
votes
0answers
21 views

Node form alter place default value for select list

I have node form for Images content type which have a taxonomy term reference field. It is a select field with the options in it. Now I am trying to place a default value for the field by checking the ...
0
votes
2answers
33 views

what can replace hook [closed]

I am a newbie into Drupal. what else other than module name can replace 'hook' from any hook function in Drupal? For ex. "myModule" replaces hook in hook_form_alter and defined as ...
0
votes
1answer
20 views

Using getThirdPartySetting() to get node type configurations in other hooks

In a Drupal 8 instance, getThirdPartySetting() function to save node type configurations using the NodeTypeInterface object like below $type = $form_state->getFormObject()->getEntity(); ...
0
votes
1answer
28 views

Is it possible to override configuration with yml files?

Override configuration guide shows how users can override configuration with global $config variable, for example by using settings.php file (the same method as for D7). But is it possible to ...
0
votes
1answer
16 views

How to catch 502 exception in drupal 6?

I have problem while running batch process, this process will takes more then 5 hours to complete, before that the page got die with the 502 error. How do i catch the 502 exception in drupal 6?.
0
votes
0answers
23 views

Supply variables to custom Panel Page layout .tpl for a node_view

Using Panels, I have created a custom node_view layout for a particular content type by copying the twocolumn_stacked_sidebar_right layout to a new folder, my_layout and namespaced all of the files to ...
-1
votes
1answer
30 views

Making title unique using hook_entity_bundle_field_info_alter()

hook_node_validate() is replaced by hook_entity_bundle_field_info_alter() in Drupal 8. I need to validate the node title whether the same title is used in any other node. Title field should be unique ...
1
vote
2answers
27 views

How to create a module to insert some analytics code in the footer of website pages? [closed]

I want to create a module for Drupal 7, with a simple scope. It's just to insert the analytics code in the footer of website pages and with an option to exclude some pages if required. I just need a ...
3
votes
4answers
136 views

Hide specific sections on admin configuration page

I wondering how I may hide some sections on the administration configuration page? I would like to hide some sections entirely for instance the media section and then only remove certain items for ...
-1
votes
1answer
37 views

Field collection 'add more' and 'remove' hooks?

I am currently working on a project where i have a content type that has 2 field collections. (with cardinality 1) Each field collection has one other field collection (with unlimited cardinality). ...
0
votes
0answers
13 views

Preventing alteration of context objects in hook implementations

The documentation for drupal_alter() correctly warns that all objects are passed by reference in PHP5 and suggests cloning any context objects that absolutely must not be altered by an implementation ...
0
votes
1answer
27 views

Creating module can display map in page or block in drupal

I have two days I'm trying to develop my custom module. I want to display map in block but nothing happened. how i can called css an js file and show them in page or block? function exemple_init() { ...