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

How do I set the theme during cron run in my module code for Drupal 7

During a cron run, I have a module that will cache the markup for many nodes. My problem is that during this cron run, any markup from the render function won't go through my themes hooks or templates. From within my module code, how can I select…
curiouser
  • 970
  • 2
  • 12
  • 22
0
votes
1 answer

Drupal, Who (username) downloaded what?

Ive been searching for this answer for almost a week now. What is the easiest way for an admin to view which files an authenticated user has downloaded? To be more specific, I need the username of the user and the name of the downloaded file and…
DataGuy
  • 1,695
  • 4
  • 22
  • 38
0
votes
1 answer

drupal add node_access hook to existing module (OG)

Please don't ask why do i need to or why am I such a pervert. I have an Organic Groups module on drupal 6. I need to add node_access hook to this module for some reason. There is no preset node_access hook in "og.module" file or any file, connected…
sander
  • 388
  • 1
  • 3
  • 10
0
votes
1 answer

Drupal6: Append query string to primary links

I'm trying to add a query string "?device=mobile" onto all primary links programmatically. In my theme's page.tpl.php file I've tried the following,
Saahir Foux
  • 654
  • 4
  • 12
  • 27
0
votes
2 answers

Drupal Front Page Markup

I'm trying to change the markup around articles being displayed on the front page of a drupal site so I can integrate them into a slideshow. (I can't use a slideshow module). I have a page--front.tpl.php file, but I need to add more specific markup…
0
votes
2 answers

How to validate hook block configure form in Drupal 7

In Drupal 7 hook_block_configure and hook_block_save provide a method to modify a blocks settings and save these values. But how would I carry out validation on the form before saving the values?
Felix Eve
  • 3,811
  • 3
  • 40
  • 50
-1
votes
1 answer

Create a template file for a menu

I want to create a template file for a menu, and I am trying something like this: function MYTHEME_menu_tree__main_menu($variables) { return theme('mymainmenu', $variables); } I edit the main menu's HTML in the mymainmenu.tpl.php, but this code…
Alon
  • 889
  • 10
  • 16
-1
votes
2 answers

Drupal 7 to drupal 7 migration

I want to migrate drupal 7 to drupal 7. I used migrate module and drupal to drupal migrate module, but in total I can able migrate only 600 records among 1000 records. 400 records are failed. I don't know why it gets failed. If I Processed 57…
steniya
  • 37
  • 1
  • 1
  • 10
1 2 3
9
10