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

learn more… | top users | synonyms (1)

0
votes
0answers
9 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
30 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
8 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 ...
-2
votes
0answers
19 views

Create a custom shortcode in drupal 7 [duplicate]

I want to create a custom short-code inside my drupal module , I don't want to use any other module for my short-code to work and need to make it just like WordPress short-code , How is this possible ...
1
vote
2answers
39 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
68 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
34 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
23 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
13 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
34 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
13 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
11 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 ...
0
votes
0answers
7 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
18 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
25 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
18 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
38 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
13 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 ...
1
vote
0answers
14 views

Add percentage based fee/tax to specific product types on checkout in Drupal Commerce

In Drupal 7 Commerce, I have two product types, a service product and a physical product. I would like a 6% fee added to all physical products only when the user gets to the cart review page. ...
0
votes
0answers
27 views

Creating a Module Level Main Menu Replacement

I am looking to create a module (not theme) that replaces/augments the main menu in Drupal 7. I've got a CSS driven menu (MegaMenu style). It's generic and I want to reuse it across ...
0
votes
0answers
35 views

Upload image temporary and on form submit make it permanent

I have made a custom module where I load the create node form for an "announcement" content type. What i want Besides the text and select fields, I require an image field which supports multiple ...
0
votes
1answer
28 views

Is there a “hook_user_login_failed” hook? Or something similar?

I'm needing to detect when a login failure happens in Drupal and am finding it to be exceedingly difficult even after searching Google. I have to believe this exists somewhere. I found this post ...
0
votes
1answer
26 views

hook never called

File C:\wamp\www\sites\all\modules\custom_user\custom_user.info: name = Custom User description = Custom User core = 7.x dependencies[] = alter_ego File ...
0
votes
0answers
23 views

How to change sort of view 3 results based on exposed filter value?

I am showing user profiles trought views. There is one exposed filter (term reference field in user profile). For two fixed values (All and 1330) i need to change order of results from field_fullname ...
0
votes
1answer
29 views

Download count of file in table of files

So I wanted to add date alongside the size of the file in filefield table of files so I added this snippet to templates.php function mytheme_file_formatter_table($variables) { $header = ...
0
votes
1answer
21 views

hook_url_outbound_alter only for links in node body

I'm building a site with drafts/revisions as a major component. For now I'm using hook_url_outbound_alter to check if "/draft" is at the end of the current URL, and if so to append "/draft" to all ...
0
votes
2answers
23 views

How to compare new node title with already entered nodes in database

I am using node gallery module.While creating an album, when the user enters duplicate name then error message is displayed as This form requires that the fields Album name, Author are a unique ...
0
votes
0answers
12 views

Can't get hook_field_attach_view_alter to set the value of the field

I'm using some hook code I got from Drupal 7 show empty fields in order to show all of the empty fields on my node when viewing it. I would like to put a simple - as the displayed value when the field ...
1
vote
0answers
18 views

Determine whether a field has changed during hook_node_submit

Basically I need a way of checking whether a node field changed during some event hook...I am using hook_node_submit() but this doesn't seem to work: $form['field_status']['und']['#value'] !== ...
0
votes
1answer
69 views

Bootstrap Theme: Theme hook suggestion for user profiles

I've tried to create theme hook suggestions in my template.php to use template files in combination with view modes. My code snippet: function blogtheme_preprocess_user_profile(&$vars) { if ...
0
votes
1answer
16 views

Append an <i> tag to entity field view hook

On a field of field type = LINK and widget = LINK, I want to add an tag on the rendered output. The reason is to be able to add a class, not to the whole tag output, but to append a FontAwesome ...
0
votes
1answer
69 views

Code for viewing comment reply form (drupal 7)

I would like to add_css when comment reply form is viewed (not new comment form) and there is an example code below. How could the line $comment->nid == $node->nid (presumed to be responsible for ...
0
votes
0answers
25 views

hook_views_default_views_alter with handler

Is it possible to add new column with a new handler for hook_views_default_views_alter? I have previously implemented hooks_views_data_alter to add a new column and a new handler. In this ...
0
votes
0answers
24 views

drupal_add_js doesn't 'stick' outside of hook_js_alter and hook_page_alter

Putting together a module that needs to insert javascript into each based on the contents of the page being viewed. The following code block works fine in hook_js_alter and hook_age_alter: ...
0
votes
0answers
14 views

Data updated in views->result does not get rendered

During the hook_post_execute process I'm trying to update some node fields. The idea is to make some calculations using data from views->result and then update the nodes. The node fields I want to ...
0
votes
1answer
87 views

How to parse current page URL query parameters to create link using l() function

I have a view in D7 with a few exposed filters. This view generates a URL/page like this: example.com/node?location=XXX&check-in=XXX&check-out=XXX&lang=XXX. I am looking to build a link ...
1
vote
2answers
76 views

Problems adding javascript to a specific page

Drupal Version: 6.x Currently, I have a custom module created. In my template, I keep html code that I would like to embed within a container, such as a div, with a particular id. For this question, ...
1
vote
0answers
51 views

How to use user_load() for user on $_GET[] request in Drupal way?

I'm trying to get UID of users on $_GET[] request, following is my module code: my_module.module function hover_card_init() { $module_path = drupal_get_path('module', 'hover_card'); ...
0
votes
0answers
22 views

Extend admin/content by one taxonomy filter and avoid views

I'm looking for a possibility to add a taxonomy as a fliter criteria on the admin/content page. The following link https://www.drupal.org/node/1162340 describes something but hacks core. As I ...
0
votes
1answer
42 views

Drupal hide form items completely with states

I try to hide a whole date/image/taxonomy block on my node form dependent on a checkbox. If use the following for my title field it works perfectly. The title field is hidden/visible dependant on the ...
1
vote
1answer
18 views

How to add IE specific stylesheet in drupal 7 in drupal way [duplicate]

I want to add this into my Drupal site in a Drupal way! <!--[if IE]> <link type="text/css" rel="stylesheet" href="IE.css" media="all" /> <![endif]--> I know it can be done easily ...
1
vote
2answers
39 views

Printing current node workflow state name as the page body classes

I have a workflow system in my site using workflow module, and I need to print the node current state name as body class. I did the same with user current role in template.php with this snippet: ...
1
vote
0answers
31 views

How to Change View Filter Operator in Views Filter

I want to Set View Filter Operator to "Less Than Or Equal To" <= in Views Filter of Drupal 7. MACHINE NAME field_guests FIELD TYPE List (integer) WIDGET Select list
1
vote
1answer
34 views

What hook is most appropriate for code that should run as early as possible in bootstrapping but only on certain paths?

I am writing a module that should run code as early as possible because it's a conditional redirect to another page, so the first page doesn't need to finish loading. I only want to run it on /foo/*. ...
0
votes
0answers
16 views

customize ubercart payment gateway error message USAePay

We're currently using D6 and Ubercart with the USAePay gateway. Unfortunately, the USAePay gateway does not handle international postal codes very well. But when it returns an error the HTML is ...
1
vote
1answer
25 views

unsetting field via view hooks no effect on aggregation results

I have created a view, with some aggregation parameters. I expected that unsetting (removing) the aggregation field via some view hook (views_pre_render?) would do the trick to disable the ...
0
votes
1answer
47 views

How do I add to $page_top in html.tpl.php?

I wanted to add a piece of HTML at the top of all pages, right after <body>. In the #drupal IRC channel I got the recommendation to override html.tpl.php in the theme. That works fine. But isn't ...
1
vote
3answers
84 views

How to intetrupt a form submission in drupal

I have made a custom module where I create one page. In that page I load the existing form for creating a new content and also add a password field. In my loaded form I have an email field. I want ...