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

learn more… | top users | synonyms (1)

0
votes
1answer
7 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
7 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
17 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
39 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
22 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
17 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
31 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
14 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
16 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
28 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
41 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
17 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
33 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
16 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
56 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
44 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
71 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
27 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
29 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
25 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
23 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
29 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
57 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
31 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
34 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
22 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
19 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
37 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
29 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
54 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
15 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
116 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
34 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
29 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
18 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 ...
0
votes
0answers
8 views

token does not work in upload directory of webform

i'm using service modules for generate json data , ve it's done in json data image data is inserted but i want to insert image url in json , how can i do this ? thanks for your helping
0
votes
1answer
17 views

Hook into Panels content form submit

I'm writing a routine to track inline image usage in panel panes every time the panels content form is submitted. The hook_panels_pane_update hook works, but only after the second time the form is ...
-3
votes
1answer
29 views

Decrypt automatic created drupal url [closed]

In my project url encryption and decryption are compolsary,so help me How to decrypt drupal automatically created url (eg: "q=content/testpage")?
0
votes
0answers
14 views

Is there any core or module functionality that automatically corrects URLs in node content bodies?

Background I'm investigating some odd behaviour on a Drupal 7 website. We're using the upload replace module to turn Drupal's file versioning on its head. However, there's a bug with this module ...
0
votes
1answer
11 views

links__system doesn't use URL aliases?

I'm trying to use the links__system preprocess function to output a menu as a select element, unfortunately though $link['href'] appears to output the URL in a format like: node/2 Even though the ...
0
votes
1answer
107 views

Implement Menu block hook function hook_menu_block_tree_alter() to add/change/remove classes

I have installed the plugin Menu block and I am very happy with the result, but I'd like to change some classes in the structure. This is what I get right now: <div class="content"> <ul ...
0
votes
0answers
7 views

display non published comments with special test and condition

How can i modify in the loop of displaying the comments in drupal 7 foreach (....) { if ($comment->stauts == 0 && $comment->condition ==1){ // Display comment with new class } } ...
1
vote
0answers
19 views

how to get form_state in Modal (ctools)

I Want to get the comment form_state in the ctools modal to change a variable i was trying to use drupal_get_form but i cannot access to form_state ? Before submitting the comment form i want to show ...
0
votes
0answers
19 views

How to insert multi image with restFul service on D7

i have a little issue i try to add to my node with RESTful service on drupal 7 multiple fid for a image gallery and i can't finish the process, i try 'field_gallery[und][0][]' => array( ...
0
votes
0answers
17 views

THEME_preprocess_field() not recognised in template.php

Mail (password reset, user blocked etc..) from admin sends messages without preserving linebreaks. Then I came across https://www.drupal.org/node/1095838 to fix this issue. In turn ...
0
votes
0answers
22 views

How to integrate remote Server Side Includes into theme?

I am trying to figure out how Drupal's theming system might accommodate a particular project of ours. We are considering using D7 for a client's micro-site. We will provide licensed content under ...
0
votes
1answer
25 views

using hook_user() to capture user actions

I am trying to create a method to log the actions of users, specifically when they log in and out. I am using hook_user() method to do this. This is my code. function mymodule_user($op, &$edit, ...