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

learn more… | top users | synonyms (1)

0
votes
0answers
6 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
8 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
24 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
8 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
10 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
4 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
47 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
23 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
9 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
19 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
14 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
21 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
70 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
23 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
24 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
30 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
1answer
54 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). ...
0
votes
0answers
14 views

Alter js in Some Certain Conditions

I am using hook_js_alter to use a newer version of Jquery. function myid_js_alter(&$javascript) { // Swap out jQuery to use an updated version of the library. ...
0
votes
2answers
33 views

How can i add textbox in site information

Alter the following form. admin/config/system/site-information Add a textbox in the site details section, below the email address textfield. The name of the textbox should be site_organisation. Save ...
0
votes
1answer
19 views

Help Needed with a Hook_form_alter Module

I've written the following module and it's not working. By that I mean it's not printing the #prefix to the webform above the 'resource_name' field. In fact, it's not printing it anywhere on the page. ...
2
votes
4answers
80 views

Deleting a node just after it has been added

I want to delete a node after it has been added (or modified), if certain conditions happen. Is it possible to do that with hook_node_insert? (Considering hook_node_insert will actually be executed ...
0
votes
1answer
35 views

Using Entity metadata wrappers to change field value under hook_node_insert()

I am trying to change a field value inside both hook_node_insert() and hook_node_update() using EMW. It actually changes the original $node object that is passed to these hook functions but the change ...
2
votes
1answer
19 views

Where all are the hooks defined in a contributed module?

What are the files in which core hooks are implemented in a contributed module? Are they declared in .inc files? If so, what are the naming conventions for those include files containing core hooks? ...
1
vote
1answer
30 views

Need to send “High” and “Critical” priority only in email subject line itself

I'm using Support Ticket System module and I need to send ticket "High" and "Critical" priority along with subject line of an email. Can i do the same through coding part as i have tried from mail ...
0
votes
0answers
23 views

How to change specific comment view mode for specific node view mode?

I have one content type "xyz" in that i have created a few custom view mode for "node manage display" as well as "comment manage display". I don't know how to attach specific node view mode to ...
5
votes
2answers
124 views

Where are hooks stored/cached?

I have a hook_form_alter in a module, and it should be firing, but it appears it's not. I've cleared caches and rebuilt the registry. Is there someplace in the database or somewhere else where I can ...
1
vote
1answer
26 views

Update a field on a node after hitting save

I am working on a Drupal 7 custom module and would like to update a field on a node after hitting save. Based on some post that I have seen this should be possible. As it is now I have the $node ...
2
votes
2answers
132 views

How does module_hook() function work?

I need to check whether a hook is implemented in a module, so I chose module_hook function. In the documentation it states that the Return Value will be: TRUE if the module is both installed and ...
0
votes
1answer
21 views

Drupal Commerce Hook - Extra validation before adding to cart

I was looking for a hook that will fire after a user hits the add to cart button. The commerce api isn't very clear about this. What I'm trying to is: Add an extra validation for a customized product ...
0
votes
1answer
29 views

Where to declare an API key?

I'm confused about the following: I'm working on a module that creates a interactive Google Maps background, I've added the Javascript to my module ( which is run at hook_init), but when I try to ...
0
votes
1answer
15 views

How to edit Drupal core rdf.module functionality

Using drupal's core RDF module there is a function (shown below) that add "xml:lang" attibute to tags. What I want to do is to change this functionality so that ...
0
votes
1answer
17 views

How to find hooks being called by a Drupal page?

I am looking at module code, and this is one of my first time working with Drupal modules. How can I find which hooks are being called by the page that I am working on at the moment? I saw this ...
0
votes
1answer
12 views

Can you customize the User Edit page without editing the theme?

Is there a way to customize what appears on the user profile edit page without editing the theme? I'd much rather use blocks or hooks to accomplish this task. Is this possible?
0
votes
1answer
59 views

(solved) How to hook into ajax results (server side)?

I'm looking for a way to make changes in rendered HTML parts, when they are the result of an AJAX request, just before they are returned to the user. Currently it concerns Views, but its own hooks ...
0
votes
0answers
30 views

Drupal 7 Session -

I have a drupal 7 website. When user login, i am creating cookie till a certain date. when browser tab is closed when user is logged in, the session remains. but when we quit the browser, the drupal 7 ...
1
vote
1answer
40 views

What is the best approach to write hooks?

I had to use some hook functions on almost every project I worked, right now I am working on a project ( basically to collect donations and maintain organizations list ) where I need to write lots of ...
0
votes
1answer
13 views

How to rename image filename and make same as title field value

Can somebody also help me to rename the image name same as title field? I have a image content type where we have title and image field and when I submit the form I want to rename the image name same ...
0
votes
1answer
16 views

How can hook some code before deleting a comment?

How can I add few lines of code before comments get deleted. there must be some hook or something by which we can do this. I am getting nothing relevant by Googling. Any help appreciated.
0
votes
0answers
21 views

7 - Add a webform component programmatically with a hook

I have a two step webform, wherein on step 2 based on how many files were attached on step 1, I would like to add that many text fields on Step 2. Is there a way to programmatically add text boxes to ...
1
vote
1answer
38 views

simple external variables to hooks [closed]

Using drupal 7, Views 3, I have a function (present on Leaflet Module) which takes only 2 parameters. I use this hook function to print resulting points from view in different colors //Allow modules ...
0
votes
2answers
16 views

Change Drupal Views Rows before they were rendered

I want to change the output of a view. More precisely i want to reduce the resulting list to exact 3 matches: one specific row and its previous and next row. As far as I understand I need to generate ...
1
vote
2answers
33 views

How do I trigger an event when a button is clicked on a user profile?

Let's say I want to make a bunch of nodes based on what's in a specific field when someone clicks a button on their user profile. Is this possible with a custom built module? And if so what hook ...
0
votes
0answers
63 views

Restws module exposing custom module content

I'm using RESTws module and access content via /node/id.json. I've written a custom module and use the "hook_entity_property_info" which exposes these fields: { "entity_id": 6655, "cloudinary": { ...
1
vote
1answer
36 views

How to implement a custom hook

I have implemented a custom login module and I want to keep it on general purpose state. This module have been developed because users can be authenticate against an internal LDAP Server (Sun ...
0
votes
0answers
14 views

views exposed filters programmaticaly adding content titles as select list with content types

I have created a view which displays content types as select list with exposed filters as my requirements, I want to add a select list of content titles. Example I have an content type article which ...
0
votes
1answer
22 views

Force access denied on 'admin/structure/menu' for everyone except admin

I need to write a "simple" feature in custom module which returns access denied for all the users except admin who tries to rich 'admin/structure/menu'. I've tried with hook_page_alter, ...
0
votes
2answers
38 views

Adding a radio buttons in views exposed filters for published and unpublished drupal 7

The above view shows articles content type, which is exposed filter.I want to add a radio buttons as i have shown in image for published and unpublished,can I get this functionality programmaticaly ...
0
votes
0answers
10 views

Ajax error message in hook_validate() [duplicate]

I'm using drupal commerce kickstart and kind of stuck in this problem. I'm using hook_validate() on my custom module and this validation is called in an AJAX way. I'm using form_set_error() to show ...