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

learn more… | top users | synonyms (1)

1
vote
1answer
13 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
21 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
61 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 ...
1
vote
1answer
26 views

How to use hook_menu to add an item to the secondary links?

Adding an item to the primary links is easy: function hook_menu() { $items = array(); $items['bla'] = array( 'title' => 'bla', 'page callback' => 'mymod_blah', ...
0
votes
1answer
31 views

Registering User Programatically with only Email Address

My Drupal 7 site utilizes the email_registration and logintobbagan modules. It works fine to register users with just their e-mail address. However, on a separate page I am using a newsletter ...
0
votes
2answers
47 views

how to output image file from database drupal 7?

I have created testing module that will upload image and outputting it to my page. but, I can't seem to output my image file from my database. here's my code function database_ex_menu() { $items = ...
-1
votes
0answers
12 views

Hook _entity_presave never called [on hold]

I have a custom content who contains one multiple collection field. From a custom module, I get and set the multiple collection field of my custom content. In a another custom module, I want modify ...
0
votes
0answers
6 views

Passing a variable set to value of og_group_ref field causes functions to return empty

I have the following hook: /* Implementation of hook_comment_insert() */ function my_utils_comment_insert($comment){ if($comment->node_type == 'comment_node_post'){ $author = ...
1
vote
1answer
17 views

how to write hook that hides /shows fields if option selected in node creation

I'm needing help writing a hook that will remove price display and show a text field if a "hide price" option is selected during node creation. It just needs to be hidden in the node and catalog ...
-1
votes
1answer
14 views

Can I work with hook_user_login() directly within user.api.php?

Somewhat new to Drupal... this is probably a softball for all you Drupal pros out there. I need to update a custom table in the database each time a user logs into Drupal. I thought I'd be able to ...
0
votes
0answers
16 views

Appending a submit handler to user_pass_submit to enable form redirect after submission

If I understand correctly, having $form['actions']['submit']['#submit'][] = 'my_extra_submit'; in a hook_form_FORM_ID_alter would execute my_extra_submit after it executes the default handler. ...
0
votes
1answer
13 views

Drupal 7 views 3 add custom filter handler for an existing field

How can you implement custom filter handler for an existing field in Views 3? With hook_views_data() you can expose a new table to views but how can you alter the handler for an existing field?
-5
votes
0answers
36 views

How to learn and understand core drupal 8 [closed]

Please refer me some tips or tutorials or guidence how to learn drupal 8? symphony is must learrn before to learn drupal 8?
0
votes
1answer
18 views

How to make blocks contextually aware of current webform page

I have a multipage Webform that lives at a single URL and I would like to place certain blocks depending on which page the Webform is on. None of the webform hooks give access to page number, and the ...
0
votes
1answer
27 views

Theme function cannot be found Drupal

For some reason my theme function is not being found by Drupal. I swear I have followed everything and spent hours of time trying to make this work to no avail. Plus with not a single answer in the ...
0
votes
0answers
167 views

Saving and Publishing nodes to different domains based on revision

Need some creative help (or obvious answer/new module I'm missing). Still rusty in Drupal, so bear with me here... Using: Domain Access, Revisioning, and custom module using hook_node_presave() ...
1
vote
1answer
42 views

Is there a hook when a relation is created, updated or deleted?

I know how to use hooks like hook_node_presave. Is there also a hook to catch the deletion of a relation or the update of a relation? In the API I cannot find anything. Maybe there is a workaround? ...
1
vote
1answer
43 views

Do something in hook_node_load only when displaying node

Is there a way to run a specific block of instructions in hook_node_load only when the node is loaded do be displayed and not when it's loaded in the edit form? The only way I can imagine is ...
1
vote
1answer
29 views

How can I remove emoji from all user input?

It looks like iPhone emoji are not currently supported in Drupal 7 on MySQL. When I try to save a node containing an emoji (I 💛 U!) in the database, I get an SQL error: PDOException: ...
0
votes
2answers
29 views

How to debug hook_form_BASE_FORM_ID_alter not working?

I am at wits' end. I have a clean install of Drupal 7.28 and a custom module with the following two hooks: /** * Implements hook_form_alter(). * / function mymodule_form_alter(&$form, ...
0
votes
2answers
31 views

hook_pathauto_alias_alter() on bulk update

EDIT: I've found out that this question doesn't make sense. The problem isn't that the hook is not called during the bulk_update. The problem is that the code generates unexpected aliases because of ...
0
votes
0answers
23 views

download count module increment 2 times [duplicate]

i am using file download count module and set file field as a file force genric. but, when user download any file, now its increment 2 times i have done debug and find the issue.. so i found in ...
0
votes
2answers
40 views

How do I add HTML to my module's custom admin page?

I have set up a new page in my admin for my module like so: /** * Implements hook_menu(). */ function scraper_menu() { $items = array(); $items['admin/scraper'] = array( 'title' ...
1
vote
2answers
49 views

Which hook to use to reorder multi-value field values before saving content

I have a multi-value field added to my content type. It is actually a field collection. The users can add unlimited items to this field, and rearrange the items using Drupal's drag-and-drop utility. ...
0
votes
0answers
23 views

hooks: get context/trigger

I'd like to use the hook_node_presave. In order to perform action inside the hook correctly, I'd like to know where the node_presave call comes from. It may come from a node edit form, or from a Views ...
0
votes
1answer
29 views

Hook user register action

How to hook user registration page? Basically I want to save some cookies when user comes on the register page through an affiliate link. I used hook_user_view but it is working only when user is ...
0
votes
1answer
12 views

I would like to create a view where I can add tags to content

I am pretty new to Drupal and have not created a module yet. I think the solution I am looking for will have to be a custom module and would like some tips on how to get started. Basically I have a ...
0
votes
2answers
21 views

alter/remove taxonomy term path if no related nodes

I'm using taxonomy menu and nice menus to generate the page main menu. Not every term has related nodes, but the customer wants them all to be in the menu, but the "empty" terms not clickable. And ...
0
votes
1answer
21 views

User tabs and actions

I have a custom module and in hook_menu have defined the items below. I have created a new user tab below: $items["user/%user/TAB"] = array( "title" => t("TAB"), "page ...
0
votes
1answer
36 views

hooks inside template.php [duplicate]

Everytime I use drupal hooks I always take the custom module route and call the hooks from there. I'm basically talking about all the hooks in drupal -- hook_form_alter(), hook_page_alter(), ...
1
vote
2answers
46 views

How do I intercept a press on “Save” and get the nid?

I want to get hold of the nid of the newly created node whenever a new node or comment is created by a user by pressing "Save" (and only when the user press "Save" - not when the node is created or ...
3
votes
1answer
206 views

Difference between Hook and function [duplicate]

I have a confusion regarding the hook and a normal function, So can any one tell me what is the significant difference between a Drupal hook and a normal PHP function in Drupal.
0
votes
1answer
18 views

Hook Advance Search Form

I want to hook the Drupal advance search form for add more filter criteria, I want to add the below criteria 1) Search By Post Date 2) Search Between Post Date 3) Search by last day, last 7 days I ...
0
votes
2answers
42 views

how to prevent applying discount for a product

I'm trying to change the product price based on the purchase type. I have added two radio buttons in add to cart form, one is retail and another one is wholesale. The default value is retail, so the ...
0
votes
1answer
22 views

D7 - List entries on config form

I have what should be a simple question. I am coding a module that allows the user to add meta and link tags to the of your HTML page..think of something similar to CSS injector. (I'm sure something ...
0
votes
1answer
79 views

How to trigger hook_form_alter() on my custom $form?

I have written a custom module which builds a custom user_profile_form(): mymodule_user_profile_form($form, $form_state, $user) { module_load_include('inc', 'user', 'user.pages'); $form = ...
0
votes
2answers
50 views

How to prevent double form submission in drupal

How to prevent double form submission in drupal when i create basic page and click submit 10 times.. then node create 10 times of same content please suggest me, how to prevent
0
votes
2answers
43 views

What is the best way to stop a node from loading in a node hook?

I want to use hook_node_view to stop a node from loading if it was not created by the user trying to access it. What should I include in the following code to kill the loading of the node? function ...
0
votes
0answers
17 views

how can i save webform in a different table in my database?

i have a webform that receive values from database and empty fields are edited by user. and after that when user submit that form, it should update the records in the same table from where it receives ...
0
votes
0answers
14 views

add links to the switch user admin menu dropdown

Here on line 532 of admin_menu.inc is the function that adds the switch user users under the user drop down (so the admin can log in as another user by click on one of the links). I can easily just ...
1
vote
1answer
44 views

find the hook altering a views query

I try to find the hook/module who's modifying a views query. It's a views of the module Workbench displaying the draft's of the actual user... If I Disable SQL rewriting in the Query settings the ...
0
votes
1answer
20 views

hook_form_alter #attributes and #disabled

I'm using Drupal 7 and Advanced forum. The users when will create a new topic will be able to select the forum container and forums, but if they select a container, an error will be showed. I want ...
0
votes
0answers
22 views

How to retrieve data from table to a webform in drupal 7?

I am using drupal 7 and created a webform. i just want to show data from my existing table to that webform. i just created this code in .module file: function publish_webform_node_load($nodes, ...
0
votes
2answers
17 views

Assign custom id for user on registering

I need to assign custom ids for all users. The Id will come from API and its depend on other filled by user custom field. Witch hook should I use and witch variable holds id value?
0
votes
1answer
25 views

Modify a variable before it saves to database

I have a user profile form. I'm having trouble modifying a variable before it saves to the database. I have these hooks in my template.php but the value going into my database is still the same ...
0
votes
1answer
29 views

when the hook_block_info is get called?

when hook_block_info() hook_block_configure() hook_block_save() hook_block_view() are get called? is it possible to call these hooks manually in a module?
0
votes
1answer
19 views

Hook function for admin/structure/taxonomy/your_vocaburary form (Save and Reset to alphabetical)

I'm looking for a hook function to interact with the buttons "Save" and "Reset to alphabetical" on taxonomy term hierarchy. Does anyone know how to override this functionality?
0
votes
0answers
33 views

How do I load and display external content when displaying a node?

I am trying to implement a new content type that has one field--a URL--and when a node of that type is displayed the content at that URL is fetched, filtered, and displayed to the user. So far, I ...
0
votes
0answers
11 views

Drupal7 set_variable in one database from multisite

I have a multisite and I need to change a variable value stored in variables table in one database. How would I use the set_variable function to only target a specific database rather than updating ...
0
votes
2answers
49 views

hook_views_pre_render and hook_node_view

In my custom module I'm creating a logic with two fields. The first field is an image and the second is date field. When I choose past date from the date field, the image field should be hidden. If ...