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

learn more… | top users | synonyms (1)

2
votes
4answers
72 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
32 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
15 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
24 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
21 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
122 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
126 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
15 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
26 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
13 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
14 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
11 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
43 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
24 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
38 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
8 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
15 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
16 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
36 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
13 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
30 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
55 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
33 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
11 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
20 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
28 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 ...
0
votes
0answers
14 views

How to change the icons used for printer friendly module

I would like to change the icons used in the printer friendly module as the default ones supplied don't suit my theme. How do I go about doing this? I assume I should a hook of some sort, but sure ...
0
votes
0answers
33 views

drupal default image field without “remove_button” on edit form drupal 7

I have created one event content type. On which I Have field_event_picture image field. Now what I want is, when user edit event form user will click on field_event_picture and browse popup comes up, ...
1
vote
1answer
19 views

A hook that would check if the module is enable?

I'm not looking for hook_enable (which would trigger when the module is been enable). I have a module that would work alone (lets call it custom_module_1) and I have another module which is an add-on ...
0
votes
1answer
26 views

how to alter a hook_field_insert

I am trying to find a way of altering the output of a hook_field_insert. In my exact example, I'm trying to hook into the link_field_insert hook, in the Link module: /** * Implements ...
1
vote
1answer
15 views

Cache + random + hook_form_user_register_form_alter

for a captcha purpose, I'm trying to set a random number in the hook_form_user_register_form_alter For example : function my_module_form_user_register_form_alter(&$form, &$form_state) { ...
0
votes
1answer
26 views

How can I reorder active menu items programmatically?

I have an 'audience' menu which has 4 links. When a user visits one of these links, it becomes active, and I want to push it to the front of the menu item list. Outcomes would like like; Pitchers | ...
0
votes
0answers
12 views

Why is hook_mail_alter() triggered 2 times?

I have set up a hook_mail_alter to send a private_msg when a email is sent. Everything seems to work well except the fact that the hook is triggered 2 times. I tried with different kind of emails, ...
0
votes
1answer
21 views

Giving custom argument value in 'q' variable

We want to use a custom template page when a specific value is given for the q variable in url . For example if we give http://localhost/drupal/?q=xyz/123 , we want to use a custom template page ...
0
votes
1answer
42 views

Date Of birth in drupal

I am newer in Drupal. I am using Drupal services. I want to insert user birthdate by Drupal rest services. I want How we do this, Any help would be appericiated. Thanks in advanced
2
votes
1answer
25 views

More then one module implementing hook_module_implements_alter for the same hook

How can i know what module will implements earlier? I have a module (custom) which implements hook_module_implements_alter and other module (contrib) also implements. In this case the contrib module ...
0
votes
1answer
31 views

How to use hook_block_view_MODULE_DELTA_alter on Views-exposed form?

I want to use hook_block_view_MODULE_DELTA_alter to modify a Views-exposed form. The URL path to the configuration page for the block is: ...
0
votes
1answer
42 views

Using hook_js_alter to change localsettings variable in the autologout module drupal

I want to know how to use hook_js_alter to change the localSettings variable in autologout.js. In autologout.module in line number ( 377 - 389) $settings = array( 'timeout' => $refresh_only ? ...
0
votes
0answers
21 views

Rebuilding webform_select_options_info lists () [closed]

For one of my sites, I use the hook_webform_select_options_info() function bind a callback function to retrieve a list resulting from my database. My list 'country_list' appears correctly in my ...
0
votes
0answers
27 views

hook_views_data without any join

i have a custom table created using .install file and in views.inc i am writing code to expose fields to views but i dont want to join that table with node. my code is as follow function ...
0
votes
0answers
45 views

rules_invoke_event() not working with 'user_login'

Very broadly, I want to know how to use the rules_invoke_event() for the event listed in the admin UI as "User has logged in". The parameters I passed to the above function were 'user_login' and ...
0
votes
0answers
10 views

Expose fileds to views using hook_data

.module file /** * Implements hook_views_api(). */ function core_sms_views_api() { watchdog("test","<pre>".print_r('imhere',TRUE)."</pre>"); return array("version" => "3.0"); } ...
0
votes
2answers
62 views

How to make submit button work in form themes

I am trying to create a form which calls an external template file to format the form but ended up into a typical issue. This is what I was doing. I created a hook menu and called a theme, in the ...
0
votes
1answer
27 views

how to update my custom table after execution of rules

i have created a table as follow <?php /** * @file * Implements hook_schema */ function core_sms_schema() { $schema['core_sms_details'] = array( 'description' => 'This table is used ...
1
vote
0answers
128 views

Parse error: syntax error, unexpected 'use' (T_USE) [closed]

I've propagated the 3rd party PHP SDK for Facebook APIs using Libraries and I've also enabled X Autoload but still I'm getting this error Parse error: syntax error, unexpected 'use' (T_USE) ...
0
votes
0answers
30 views

CSRF Validation Failed On Creating Node

I am connecting Drupal Services to iPhone. On sucessful Login i am getting session id , session name,token . Then I want To create node . I am posting token value in X-CSRFToken and ...
2
votes
2answers
70 views

hook_menu parameter can contain a forward slash

I've built a custom module to get cloudinary images and it works great. However, a bug has cropped up. You can navigate to /cloudinary/resource/public_id and it gets the image with public_id. On ...
2
votes
1answer
57 views

hook_menu not working with alias

I have a hook_menu: $items['node/%/tokens/%api_token'] = array( 'title' => 'View an API Call', 'page callback' => 'drupal_get_form', 'page arguments' => array('api_token_edit', ...