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

learn more… | top users | synonyms (1)

0
votes
1answer
14 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
0answers
4 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
12 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
8 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
16 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
32 views

what can replace hook

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
18 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
0answers
7 views

Hook Schema Duplicate table creation

I followed all the steps to create a custom table, then have "Inspect" in the Schema module generate my code for me, and I inserted that in. My table for this example is called "Building". After ...
0
votes
1answer
21 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
12 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
14 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 ...
0
votes
0answers
11 views

How to override hook_mail() function?

while user registering user_mail is calling by default. And i want to change body of the mail.In UI http://localhost/xxxxx/admin/config/people/accounts we have settings.ii want to override using ...
0
votes
1answer
25 views

Making title unique using hook_entity_bundle_field_info_alter() - Drupal 8

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 for ...
0
votes
0answers
10 views

How do i customize the node/add Page and add it to my Content Type?

i want to add a add_node to my content type. i already found that code and it works for me but i wanted to output only the fields that i really needed. <?php module_load_include('inc', 'node', ...
1
vote
2answers
25 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
126 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 ...
0
votes
2answers
27 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
9 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
25 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() { ...
1
vote
1answer
12 views

Get display name from hook_preprocess_views_view

I want to use hook_preprocess_views_view in order for several views to share the same template, by adding theme_hook_suggestions as described in this article: ...
1
vote
1answer
27 views

Add custom HTML to custom field

In a module, I have defined a custom field. Using hook_field_formatter_info() and hook_field_formatter_view(), I can manage the display of every item (value) within that field. I want to allow the use ...
0
votes
1answer
12 views

hook_theme_registry_alter caches

this function caches the output, so it doesnt work if I want to change dynamically between two template files. For example user-profile.tpl.php and user-profile-project.tpl.php Code: function ...
0
votes
0answers
9 views

Get notification when receiving translation from GlobalLink through Rules Module

I have configured Rules and GlobalLink Modules. Now my concern is that I would like to get notification when translated content receive from GlobalLink module through Rules Module. So how can I go ...
1
vote
1answer
16 views

Proper approach for showing menu based on node

I'm setting up a new Drupal site and created a content type, taxonomy, and two menus. The taxonomy just has 2 items, which correspond to the menus. What I'd like to do is render the corresponding menu ...
0
votes
1answer
13 views

What hook is triggered when adding / updating and deleting taxonomy?

I need to update some value in database when a taxonomy term is added or updated or removed. What is the proper hook to use here ?
1
vote
1answer
33 views

How to know from variables tu use them in a custom code [closed]

I know it's a newbie question, but it's take me a lot of time to find a a small code for a small fonctionality. for example I wanted to make the address phone field required, I didn't know how to ...
0
votes
1answer
26 views

re-triggering hook_user_default_permissions?

I build a module that implements hook_user_default_permissions to manage permissions for my site. It's been installed on the site, and its permissions took. But now, a while on, I am making some ...
-1
votes
2answers
37 views

drupal 7 default table to store form values [closed]

I am new to drupal and creating a module consist of a form. Now I want to store values in database, please tell me what is the default table in drupal to store form values? Like in WordPress we have ...
1
vote
3answers
51 views

Action on module enable?

I want to show a message when a module is being enabled. I used hook_modules_enabled and it shows me the message while enabling a new module. Now I need the currently enabled module machine name in ...
1
vote
2answers
36 views

Set CSS class for the comment block [closed]

Could you please advice how to set additional CSS class for the comment block using Drupal hook. I'd like to paint the author and date of the comment with green color if the author of comment is not ...
1
vote
1answer
25 views

How can I create a page in Drupal that doesn't appear in the Drupal configuration menu?

How can I create a page in Drupal that doesn't appear in the Drupal configuration menu? For example: admin/config/handler, but the only way is the direct link. There is no link in the configuration ...
0
votes
0answers
12 views

Override function AddtoAny open in new window

What is the right way to override this function from the AddToAny module? My aim is to open the AddToAny page in a new page. I can override it in the original code, but I am not able to create a copy ...
0
votes
1answer
11 views

Show advanced search form outside fieldset

When I search for a keyword in core Drupal search, it shows a results page with a link named Advanced search that hides a fieldset with more form options. I want it to be shown in the basic search ...
1
vote
1answer
14 views

Get the return value of a hook defined in a module?

Is there a way to get the return value of a hook defined in a particular module for eg: $views_theme_hook = module_invoke('views', 'theme'); By using module_invoke function, I got an array of ...
1
vote
1answer
35 views

Passing variable from preprocess block to the block body

There is a block which its body is produced by PHP Code. I need to set a variable before loading the block and use it in it. This is my code function THEME_preprocess_block(&$variables){ ...
0
votes
0answers
10 views

changing default product price programmaticaly if and only if skus match between code and default skus

using http://stackoverflow.com/questions/13491983/drupal-commerce-line-items-alter-the-price/21395149#21395149 by Tim Yao I am able to change default price in cart for all products with same price ...
0
votes
0answers
15 views

webform hook_mail_alter not working

I'm trying to give a new to address to all forms, but for certain webforms, it is not at all entering the hook_mail_alter function development_environment_settings_mail_alter(&$message) { if ...
0
votes
0answers
19 views

Arrays of integers in Views Datasource JSON output

I'd like to output my pages content as JSON file. I've creates a module using Field API, for a custom variable containing RGB values in three fields. When processing the content of the page I'd like ...
0
votes
0answers
5 views

Default Bulk operations not working?

In the comment admin page, where all comments are listed, I'm adding few additional operations to the already existing Publish the comments Delete the comments I am including few options like, ...
1
vote
1answer
50 views

How do I know when Hooks are called and in what order?

I want to alter a HTTP header and I am looking for the appropriate hook to use. I can tell a general time of when some hooks are called but not exactly when. How do I know exactly when hooks are ...
0
votes
1answer
33 views

Hook_search_execute();

i am using this hook in my custom module but getting a fatal error Fatal error: Cannot use object of type stdClass as array in C:\wamp\www\bid\includes\common.inc on line 5901 anyone can ...
0
votes
2answers
11 views

Removing Duplicates with hook_views_prerender

I have a view (filtering on content) that is returning duplicates. I am trying to used hook_view_prerender to remove those duplicates... but even after running this, I still get duplicates... Any ...
0
votes
1answer
30 views

Add Custom Bulk operations to an existing Views

I am creating a custom bulk operation using hook_action_info and I can see that the operation is created successfully. But however, I want to add this to an existing views. I can do this using Views ...
0
votes
1answer
17 views

Table creation in install module returns error [closed]

I am trying to create a table using a custom module in the install file: function leave_tracker_schema() { $schema = array(); $schema['leave_balance'] = array( 'description' => t('The base ...
0
votes
1answer
31 views

Auto Increment value for field collection

I have a field collection group to which I am importing values using Field Collection Feeds Importer. This requires a unique identifier field within the field collection. This has posed an issue where ...
2
votes
1answer
86 views

Theme hooks vs module hooks

Sometimes when I try to apply a hook, just to realise it's supposed to be in a module file. Is there a way of knowing what hooks can be implemented in a theme's template.php file, or one in a module? ...
0
votes
0answers
36 views

How to programmatically take a quiz with multiple questions

I have one quiz with multiple questions.I got a solution for taking quiz with multiple questions. $account = user_load($quiz_taker_uid); // Load quiz and question nodes $quiz = node_load($quiz_nid); ...
0
votes
0answers
34 views

Plugin still uses the old version of Jquery even after hook_js_alter

I have drupal-7.34 installed and Im using Jquery Update 7.x-2.5 to make my plugins work. Everything is working fine until I had use a plugin which needs a more recent version of Jquery(jquery ...
1
vote
2answers
33 views

Using hook_node_presave to auto-select a reference field from a field list selection

I'm trying to use hook_node_presave to select a value in a term reference field based on a selection a user makes in a field list field. The term reference field is hidden from the user. The code I'm ...
3
votes
2answers
92 views

How to implement Page not found (404) for unpublished content?

On my site, some nodes are unpublished forever instead of being deleted. I'd like to return Page not found (404) for anonymous trying to access unpublished node pages instead of Access denied (403). ...