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

learn more… | top users | synonyms (1)

1
vote
2answers
20 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
33 views

Restws module exposing custom module content

I'm using RESTws module and access content via /node/id.json, which is great. I have written a custom module and use the hook_entity_property_info which exposes these fields: { "entity_id": 6655, ...
1
vote
1answer
27 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
7 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
18 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()

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
13 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
20 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
15 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
19 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
13 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
20 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
11 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
20 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
41 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
23 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
24 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
37 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
16 views

Rebuilding webform_select_options_info lists ()

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
20 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
34 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
52 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
22 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
62 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
24 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
62 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
49 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', ...
1
vote
2answers
74 views

All page access only to administrator in

I want to restrict my page access. Only an administrator should be able to see the page. I followed this tutorial function example_menu() { $items['example'] = array( 'title' => 'My Page', ...
0
votes
2answers
36 views

getting the value of line item entity field in CommerceLicenseRemoteBase class

I am extending CommerceLicenseRemoteBase class for remote synchronization. I have added a custom line item and require that value in CommerceLicenseSynchronizableInterface::synchronize(). How can ...
0
votes
1answer
35 views

Custom form set error for user login validate

I have used a custom validate function. function user_information_form_alter(&$form, &$form_state, $form_id) { if ($form_id == 'user_login' || 'user_login_block') { ...
0
votes
1answer
21 views

Block defined in code not appearing in admin interface

I have implemented hook_block_info() to define a block inside a custom module 'x'. I have followed the documentation and believe the values in my array are correct. I have cleared all caches multiple ...
0
votes
1answer
29 views

Save a user field without calling hook_user_update

I'm building a module that has to sync users with another, non-drupal, db. When the hook_user_update is run I check to see if the user has an account in the other db. If they don't then it creates a ...
1
vote
3answers
33 views

Multiselect values not getting saved in hook_settings()?

This is the code I have implemented in my module which is working fine! /* * This is a helper() */ function MYMODULE_feeds($page_id = '') { foreach($pagefeed['data'] as $feedval) { ...
0
votes
1answer
30 views

Is it possible to create a custom theme function?

I want for example to create a mytheme_table function to override theme_table etc. (in template.php) but I do not want to use it everywhere in my project. I need to replace the table with a div or to ...
1
vote
2answers
63 views

How to execute request-specific tasks after page response is returned. Does hook_exit() actaully do this?

I'm trying to figure out if it's possible to "hide" the perceived execution time of some end-of-request logging tasks that are page specific and depend on the availability of the Drupal DB API. ...
1
vote
2answers
62 views

How know inside hook_entity_presave() if it's a create or update?

How know inside hook_entity_presave() if the entity is create or update please ? Thanks. Note: I want use presave and not update and insert hook.
0
votes
1answer
39 views

Why do only some of my hooks get called?

I made a test module and only a few of my hooks seem to get called. I get the Javascript console messages for the block_view, form_alter and form_user_login_alter hook functions when I do the ...
0
votes
1answer
37 views

Add Attribute to Textfields in Admin Theme

I'm often working with Pages in RTL Languages where the default Theme and also the admin theme are using RTL languages. What often bothers me, is to use LTR texts like Tokens or Paths in Textfields, ...
0
votes
1answer
38 views

Drupal 7 Custom Module - Creating a Block with Visibility set to “Only the listed pages”

I have the following code. It does create the block but I still cannot figure out why it is not adding that block to the desired region and also pages visibility settings are not working. What am I ...
0
votes
1answer
22 views

Display POA in Ubercart 3 / D7 for products of zero dollars

I'm building an ecommerce site where some products are price negotiable and want a way to add POA instead of a listing a price when a product is displayed. I'm kinda surprised at how hard this is to ...
0
votes
1answer
39 views

How to print the raw value of a custom user field in comments

I want to print a custom user field of the commenters. It is an Link field (https://www.drupal.org/project/link). Some users have that field completed and other not. I've read a lot of posts related ...
0
votes
1answer
44 views

Adding class to nested UL in Drupal 7 menu

I'm creating my menu using view along with Bootstrap to create a mega menu style navigation. I'm having a problem with the nav showing expanded at times when you come to the site and or refresh. not ...
0
votes
1answer
60 views

Add field to existing content entity

I am trying to add a hidden field to all nodes in my module (for any node type even new ones being created later on). Would this be the correct code? $field_storage = ...
0
votes
1answer
19 views

Appending multiple tables in drupal 7 module

I am appending three new tables in my custom module using hook_update, but it is throwing below error when I try to run update.php file PDOException: SQLSTATE[22003]: Numeric value out of range: ...
4
votes
5answers
121 views

How can I remove the “The image was resized to fit within the maximum allowed dimensions…” message without hacking core?

By default, Drupal prints out a notification message that images exceeding the maximum dimensions were resized. I want to disable this message. The relevant line is located in ...
0
votes
1answer
47 views

How do I use hook_views_pre_render in template.php in Drupal 7?

I have some auto generated data from my articles stored in a view(my_amazing_view). I also have a custom field in articles where user can enter similar data. If user has entered the data, i want to ...
1
vote
2answers
41 views

How might I have Webforms save files to private file system or as a database blob?

In Drupal 7, I have the file system configured as In the code for the Webforms' file component located at sites/all/modules/webform/components/file.inc, it appears that one could easily change it ...
0
votes
1answer
21 views

How to use other properties in hook_entity_property_info_alter()

I want to extend the entity properties of OG-Membership to use it as a token in rules. It works fine adding the property (for example the string 'test' as returned in the getter_callback is printed ...