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

learn more… | top users | synonyms (1)

0
votes
2answers
13 views

What is 'value' type of the field?

Could you please explain how it works: $form['support']['priority']['#type'] = 'value'; On my site this code is used to hide Priority field. But I don't understand the logic (I'm pretty new in ...
0
votes
2answers
20 views

How can I hide specific user from dropdown list of users

Could you please help me with one little question. I'm using Drupal module Support Ticketing System. When the support ticket is created user can choose from dropdown form for whom this ticket is ...
0
votes
0answers
19 views

How to Include a php file in a block from a custom module? [on hold]

I am new to Drupal and PHP. I am trying to create a module that when activated creates a page, then creates a block, configures block to only show on the created page, and then display an included PHP ...
1
vote
1answer
20 views

Render tokens in hook_node_view

I am creating the following pseudo field in hook_node_view: function user_guides_node_view($node, $view_mode, $langcode) { $node->content['field_mytest'] = array('#markup' => '<p>This ...
0
votes
1answer
20 views

Menu is not creating in admin/settings page?

I am adding a custom module, and wants when someone install the module, menu will be added to add data in the admin/settings page... But i am getting nothing: Below is the code i wrote.. ...
0
votes
0answers
18 views

How can I change view data after the query is executed but before it's output?

I tried hook_views_pre_render but it's not acting as I would have expected. What I'm doing is taking the view data after it has been executed, looking at the result, and then changing the result. ...
0
votes
1answer
22 views

How to alter view query

I am just looking for altering select query, created by any view just before its execute. For e.g. I want to add some manual filter which I can't add from Views' UI. Thanks in advance
0
votes
0answers
15 views

entity eck create new property type or/and behaviour

I guess everyone here has done what I want multiple times and I am probably just stupid but I can't seem to find it. So in my drupal 7 installation I want to create an entity with a date property(so ...
1
vote
1answer
15 views

Calling hook_entity_view from a theme

Is there any way to call hook_entity_view() from a theme? I tried adding the implementation to the template.php file, but the function is not called. I know I can do it via custom module, but as ...
0
votes
1answer
22 views

Perform action on logout,

I would like to add javascript on logout. I tried using hook_user_logout but the javascript doesn't get added. Even adding something as simple as drupal_set_message doesn't result in a message ...
0
votes
0answers
19 views

Which hook to use in a custom module for tracking access to one particular page?

I'm probably not fully awake this morning because it seems so trivial but I cannot figure it out. I need a hook to track when user access a certain page (path = 'export-csv'). This page is not a node ...
1
vote
0answers
21 views

Help with form select options and sorting of values

I have altered the log-in form to my client's specification and I'm having problems with the display and sorting. As you can see, I have a select list called Organization. That is the Username Text ...
1
vote
1answer
117 views

Make a direct database query

Basically I want to run this query against the current database and retrieve all node titles with node type of foo_type. SELECT title FROM node WHERE type='foo_type' ORDER BY title ASC How can I do ...
0
votes
0answers
17 views

Programatically alter field label using hook_views_pre_render

I know this can be done easily using the Views UI under 'rewrite the output of this field'. But for some reason I really need it done through a custom module using hook_views_pre_render (or possibly ...
0
votes
1answer
19 views

skip processing html and page

From a module, I want to output "hello world" simply as a string as efficiently as possible when i call /mymodule/helloworld. ofcourse, using hook_preprocess_html and hook_preprocess_page i can ...
0
votes
0answers
15 views

Hook form alter, adding currency symbol to value?

I am using drupal 7 and have created a custom module to override a field value. $form['field']['#value'] = "new amount"; which works. If I want to add a currency symbol such as ...
0
votes
0answers
6 views

registration form disable required username

I'm using the logintoboggan module, so that users identify with email and password. Everything works fine, with exception of that on the registration form is required to put a user name. It must ...
0
votes
0answers
34 views

Node Hook Returns Syntax Error To Hide Price Until Added To Cart [closed]

I have been trying to write my first module. Please be gentle. This module is a node hook that hides product price until added to cart, similar to "See Price In Cart" functionality on many websites. I ...
0
votes
0answers
4 views

Hook_node_view_alter to check for the population of the individual caption picture element and if populated then replace the “Caption for All Photos”

I have a content type called Gallery and the "Caption for All Photos" is displaying as the user is going through the pictures within the Gallery, but if an individual pictures caption is populated ...
0
votes
0answers
6 views

module_implements_alter drupal 6 alternative

what is the alternative for hook_module_implements_alter on drupal 6? I need to change the order of one special hook.
0
votes
0answers
20 views

links__system_main_menu hook - add a anchor

I want to add an anchor manually to the mainmenu of my template. So I've made a hook in my template.php: function MYTHEME_links__system_main_menu($variables) { $link = url('', array('fragment' ...
0
votes
1answer
26 views

Hooks Alter not called in Template.php for

I run into strange thing today. I have some custom hook declared in a custom module as following: drupal_alter('strange_thing', $shared_var, $vars); then in template file(template.php) I got the ...
-2
votes
2answers
33 views

How to call hook in template.php after login from any user in drupal 7?

I am using below code to get the user login gender information & store in SESSION, I want to call below code after login, I already try this hook function bartik_user_login(&$edit, $account) ...
0
votes
0answers
16 views

Modifying Drupal Login Process

Is it possible to modify drupal's login process into something like 2 steps login? Let's say 2 different step to login. 1st step will be a Dropdown List of Roles e.g Editor, Writers, Admins. 2nd ...
0
votes
1answer
26 views

Issues with a form validate hook

I'm encountering an issue tying in a #validate hook into the Drupal registration form. In a custom module, I have a call to the User Register form (the form that is used on Account Creation) and an ...
0
votes
1answer
41 views

Adding a form to the admin menu

Ive followed 3 tutorials and I cant seem to crack this. My goal is to create a form in the admin section to store some information. I have used the following to create the form and call it from a url ...
0
votes
2answers
41 views

Hook to catch a variable in a POST request to a specific url?

I'm testing an external email collection service that appears periodically at certain time intervals on a site. When a user completes the form, the application can pass the email address as a ...
1
vote
1answer
14 views

Send Email using rules or other module depending on a field value?

What I'm trying to do is when a user creates a node on content type "Sample" with the field "Priority" set to "High" that said user will receive an email notification containing the field values of ...
1
vote
2answers
36 views

How to add button to user profile page in drupal

I start using drupal(7) 3 days ago and I have small task : I'm using Profile2 Module to create 2 type of users (candite/employer) and I Want to create a button in the wiew page of the profile of ...
0
votes
0answers
31 views

Drupal 7: Why push notification module is too slow? how to optimize it

I don't know is question is good or bad... But I am very confused. On form submit, I am performing two different task, Lets say Task_A and Task_B. Task_A = "Process the form and insert into table" ...
0
votes
1answer
26 views

7- attachment added through hook_mail_alter is making no effect

I'm trying to add one pdf attachment to the mail sent on webform submission. I'm using hook_mail_alter to add attachment to the mail. Here is my code. function webfpdf_mail_alter(&$message) { ...
0
votes
0answers
15 views

file_validate_size doesn't seem to work

I'm currently learning how to make a custom module that creates a block with a textfield and upload field. So far so good, only thing is: Drupal doesn't seem to respect my file_validate_size value. ...
0
votes
3answers
45 views

Can we use Same URL in different hook menu?

I am just learning about hook_menu just the basic stuff about creating module and all. I came across this question in mind but could not find clear answer for this Are we allowed to use same URL in ...
0
votes
0answers
12 views

message_broker module

I am using message broker example module ,in my case I am able to send the message , but no sure how it is being consumer or consumer is attached to it. When I run the message broker example module ...
1
vote
2answers
51 views

How to print a custom user field in comment.tpl.php?

I'm trying to print a custom user field (field_avatar) image as a replacement for the user picture. Why? user picture file directory would not accept tokens. This mean, I could run into a scenario ...
2
votes
4answers
79 views

form submission in Drupal

i have made a custom module for form in drupal using dupal API,and made a table in my database...now What i want is to save the value of drop down box instead of it's index into database...my .module ...
0
votes
0answers
40 views

AJAX callback removed form items

I'm trying to make a dependent AJAX dropdown form. I create a dynamic form and I render it. But when I do the callback function (chili_callback) and I dpm my form, the newly added form items are not ...
0
votes
1answer
26 views

How do I disable the cache clear on comment form submission?

Unless I'm reading this incorrectly, it looks as if the last thing comment_form_submit does is clear the cache. All of it. This is done so anonymous users see the comment they posted. I have a site ...
0
votes
0answers
35 views

Facet API - Rewrite facet items via callback function

I'm trying to rewrite the link text in an Apache Solr facet block, specifically the one to drill down by bundle/content type. By default the block displays the human readable name of the content type. ...
2
votes
2answers
59 views

How to load XML to SWF on each node?

Here is my problem: I have 2 SWF files for a crossword puzzle: first one is for creating puzzles and outputting XML files upon clicking the "Save" button and second SWF is displaying those puzzles to ...
0
votes
1answer
17 views

How to use hook_rules_action_info_alter

I am running Drupal Commerce, and I want to modify the message it prints out when an item is added to the cart. I found that the commerce_cart_rules_action_info() function implements the ...
0
votes
0answers
18 views

Programmatically replace a node's taxonomy per-context/domain

I'm building a single-site back-end system which operates across several sites/domains, managing it via Context Domains, Organic Groups and custom code. All domains share the same content type which ...
1
vote
1answer
45 views

Leaflet views: how to zoom on the marker while clicking on it in order to get the popup

I am using the module Leaflet and its sub-module "Leaflet views"" in order to get a map displaying markers based on taxonomy terms. I am able to show a popup displaying the term page while I click on ...
0
votes
0answers
23 views

hook_node_presave() fired twice when adding new node

I've just noticed that hook_node_presave($node) is fired twice when adding new node. Once it's called from node_form_submit handler and the second time from entity_save. Turns out $node->nid is ...
0
votes
1answer
14 views

Template suggestion for 'content' in custom page

I need the equivalent for hook_preprocess_node for custom pages, which aren't nodes. The particular page I need to theme is provided by the entity registration module 'node/10/register'. I can add ...
0
votes
1answer
28 views

Drupal 7 method of hook_onload()

I want to add JS functions to the body tag's onload and onunload attributes with a custom module. The only hook I found was hook_onload() from Drupal 4.7, but this method has been deprecated. What is ...
0
votes
2answers
12 views

Add Help Text for User Roles Field on User Edit Page

I would like to add some help text for one of the fields displayed on the admin user edit page (the page seen when an admin edits a user account). The help text would provide a brief description of ...
0
votes
1answer
23 views

javasript invoking custom module to update user response

I have created Multiple choice questions in drupal . One node (page ) has one mcq . The answers are displayed by simple radio buttons and javascript . Now I am planing to give some dynamic behavior ...
0
votes
1answer
48 views

Moving functions in block module to inc file

I have searched everywhere for an answer to this question, and have found little to no help on the subject. The closest question to my own would be this, but the answer for it is a bit different than ...
0
votes
1answer
18 views

Theme webform using custom module

I know I could easily theme a webform using the webform-form.tpl template. However, I want to do this on the module level where the tpl is located inside the custom module folder or coded directly ...