Questions tagged [drupal-hooks]

In Drupal terminology, the PHP functions used to extend the functionality of Drupal core modules or third-party modules are called hooks.

Hooks are just normal PHP functions which allow a user to extend functionality within Drupal. They are used by Drupal core, and contributed modules. More information can be found at api.drupal.org, which has a page listing all the hooks used by Drupal core code.

Implementing hooks

To implement a hook you must create a module, and add a hook function to it. The actual hook implementation function name will replace the word 'hook' in the function name with the name of your custom module. Thus hook_query_alter() becomes mymodule_query_alter(). Drupal maintains a list of all included hooks for the site by searching the enabled modules for functions using that naming pattern.

143 questions
0
votes
1 answer

Drupal Preprocess/Hook Confusion

I'm having difficulty fully grasping the semantics in implementing hook themes, and consequently understanding the way in which preprocess/process functions are created. I'm using "The Definitive Guide to Drupal 7", which states(technically) that…
0
votes
1 answer

why don't set the placeholder attribute for contact field?

this is my code that use in hook_form_alter function for set the placeholder attribute: if ($form_id == 'contact_site_form') { $form['name']['#title'] = t('name/family name'); …
0
votes
1 answer

Drupal hook_user_update is not working

I want the last updated time of the user profile details. So i have created a table user_changes with fields ( id, uid, changed ). When i use this hook_user_update hook , then data is not inserted into the table. I'm using this function in my…
Ananth
  • 1,520
  • 3
  • 15
  • 28
0
votes
1 answer

Drupal Views Ajax Block Validation Message

I have a views block (Views 3 / Drupal 7) with a exposed filter form and the ajax mode is enabled. It works fine. I added in hook_form_alter() a validation function. It works too, but the form_set_error message shows only on a page refresh. How can…
0
votes
1 answer

does drupal path module affect other modules

Have been asked to shift a custom made module of drupal site to another site (which is based on Openpublish d7). That module primarily is for providing web service data when a specific url is called (thus the module is implementing…
Abdul Ali
  • 1,905
  • 8
  • 28
  • 50
0
votes
1 answer

does openpublish 7 have menu hook

have been asked to move a custom made module to another drupal site which is based on openpublish version 7. but after adding/activating the module , the hook menu does not seem to be working. Just wanted to ask if Openpublish has hooks implemented…
Abdul Ali
  • 1,905
  • 8
  • 28
  • 50
0
votes
1 answer

Drupal custom user registration form

I have built a custom registration form using module_form_alter hook. I have also added the required new fields to the database with db_add_field. Now I'm able to add the values to the table in user registration/ user profile edit and the values…
0
votes
1 answer

Use extra fields in ubercart add to cart form

I am trying to implement hotel booking functionality in a Drupal 7.26 website. Customers will choose hotels from a listing page and then they will select rooms within the hotel. I decided to use UberCart 3 for my booking mechanism. First I…
Shuaib
  • 779
  • 2
  • 13
  • 47
0
votes
0 answers

hook into node_admin_content() and alter query

I am working on a custom drupal module and trying to hook into node_admin_content() in order to alter the query which populates the content-type-filter-dropdown on the content administration page? I want only specified content types to be shown in…
c1u31355
  • 420
  • 5
  • 10
0
votes
3 answers

hook_views_pre_execute is not executing

I am trying to modify the query by using the hook_views_pre_execute but I think is not executing at all. Right now my code is the following: function custom_views_pre_execute(&$view) { echo"hola"; } And its never executing. In the same file I'm…
Lucia
  • 614
  • 1
  • 9
  • 30
0
votes
0 answers

drupal menu wildcard auto-loader is called multiple times

I am working on a drupal6 site, there is an custom module with a menu walidcard auto-loader like following $items['admin/content/quest/%quest'] = array( | 'title' => 'Quest', …
0
votes
2 answers

How to do something after the node is updated in the database?

I want to do something after the node gets updated in the database. I need to be able to hook into the point where the node gets right updated in the database. How can I achieve this? According to this, I need to find a new hook.
Hao
  • 6,291
  • 9
  • 39
  • 88
0
votes
2 answers

How to delete results returned from Views UI

I am getting results as expected using Views UI. But I don't want to display a particular record from the output of Views UI> How to achieve this and will I require any hooks for this? Ex. My Views return result as 1,2,3,4. Now I don't want to show…
simple user
  • 349
  • 3
  • 22
  • 44
0
votes
1 answer

Drupal 7: Hooks for entity references

Is it possible to hook on changes of entity references? Let's say I have a <- b and b <- x -> a. when a <- b changes to d <- b I want also b <- x -> a to change to b <- x -> d
machete
  • 1,127
  • 2
  • 13
  • 26
0
votes
1 answer

how to get comment id in custom_comment_form_submit

How to get comment id in comment_form_submit ? I built a custom module to send email containing comment details like comment id,url and username. But not getting comment id to generate comment url. function custom_comment_form_submit($form,…
Vikram
  • 3,171
  • 7
  • 37
  • 67
1 2 3
9
10