Questions tagged [hooks]

Use it for the mechanism that allows to extends module's functionality without editing its code.

Filter by
Sorted by
Tagged with
2 votes
1 answer
4k views

'Page not found' but hook_menu() is correct!

This is my hook_menu: $items['events/%event'] = array( 'title' => 'Event', 'title callback' => 'entity_label', 'title arguments' => array('event', 1), 'page callback' => '...
Pedram Behroozi's user avatar
0 votes
1 answer
345 views

Form alter hook in Drupal 6

I have created a content type in which I have a field that is a select box. Now I want to change all the default values of that select box. I know hook_form_alter() will work this, but I have no idea ...
Hitu Bansal's user avatar
1 vote
1 answer
766 views

Hooks for altering Views block output in Drupal 6

I have a View in which i mention 3 fields then i displayed as a block. I want to want to change value of these fields. Which hook will i use so i can change content to fields on page load ? I ...
Hitu Bansal's user avatar
0 votes
1 answer
507 views

How to build a menu hook module

I am trying to get into module building with Drupal 7. Why is $tryk = "test" not being taken for the title, but literal strings such as "testmenu" are working? $tryk = "test"; function menufun_menu(...
Jurudocs's user avatar
  • 702
0 votes
1 answer
454 views

Node Update Problem on hook Cron

I am trying to update a node in a hook_cron() function. I am using Drupal 6. Here is my code: function offers_cron() { $query= db_query("SELECT * FROM {node} WHERE type = 'product'"); ...
Hitu Bansal's user avatar
0 votes
0 answers
93 views

reformat a select list into ordered list

I have a module "custom search" installed and its producing the taxonomy list as a drop list "select list", is there a way that i can hook into that list and reformat it to be an ordered list. this is ...
saadlulu's user avatar
  • 1,760
2 votes
1 answer
2k views

How to generate an unique code for every node

I have a social article website; I created a content type named Article. When a user creates an article, I want to generate a code shown to the user. This code should be saved in the database because ...
AmirHossein's user avatar
3 votes
1 answer
2k views

How to modify term reference field in Drupal 7 custom content type?

I am using a term reference field in a content type in Drupal 7 which is a long hierarchical list of categories. In the input form, I want to show them as checkboxes and it gets displayed as a flat ...
Uzair Khan's user avatar
0 votes
1 answer
2k views

Changing form field title within hook_preprocess_form() does not work

I have customize drupal user registration form which I want to change some field titles. I implemented hook_preprocess_form() within theme and changed titles of some form fields, but it didn't work. ...
Junaid's user avatar
  • 713
1 vote
1 answer
309 views

hook_menu_alter information

I am using drupal 6.22. I have written a framework module that relies on submodules, when I install the submodule, I would like to update the administration menu to include some administration ...
Beyerz's user avatar
  • 238
2 votes
1 answer
352 views

Need a hook a little later then hook_node_insert

I am working on a module to unzip the contents of my file field after I have submitted the node. I originally tried to do this in hook_node_insert but this did not work for me because my file field ...
Mike2012's user avatar
  • 1,761
2 votes
2 answers
12k views

Help using hook_theme() on custom module

I've been writing a custom module to spit a content type into 2 pages, with custom fields accessible via a tab. For ease I've built the test case on a fresh d7 install and using the predefined article ...
tecjam's user avatar
  • 1,151
1 vote
0 answers
153 views

File path set in File field does not show up in hook_node_insert

I have a content type called project which has a File Field. Inside this File Field I have set the File Path to be "project". I have also created a custom module that implements hook_node_insert. ...
Mike2012's user avatar
  • 1,761
1 vote
1 answer
729 views

Saving default field values on node_insert

I would like to automatically save a CCK field which will be determined by the data in the $node object. Using node_save in this instance will cause an error so I need a way to simply insert the ...
Godwin's user avatar
  • 235
1 vote
1 answer
264 views

triggering email from custom module

I have a module that uses hook_menu to create several pages that are populated with SQL query results. I have been trying to configure drupal_mail and hook_mail to send these results via mail when ...
MauF's user avatar
  • 495
1 vote
4 answers
7k views

Change / Increase the node title length

I want to increase the node title length on Drupal 7, and as I guess I need to do just two things (theoretically). Change the title column in the node table to acept more than 255 characters. Alter ...
Yaazkal's user avatar
  • 160
0 votes
2 answers
433 views

How do I reformat status messages?

I'm trying to restyle the status messages block, and I just can't figure out how to do it. I ought to be able to -- it's just defining a theme function, right? :) -- but it's just not happening for ...
Jim Miller's user avatar
  • 1,948
1 vote
2 answers
105 views

When does hook_field_storage_details_alter() fire?

I need to modify the field storage details so some additional data can be stored with a form field. I found hook_field_storage_details_alter(), but it doesn't seem to fire. When is this hook used?
David Barratt's user avatar
3 votes
2 answers
3k views

hook_module_implements_alter() not working for me. What am I doing wrong?

I use D7 and need 2 different modules to parse article text on save. For simplicity's sake let's say module_one changes all f's to z's and module_two changes all foos to bars. So basically "F foo fo ...
Ari Linn's user avatar
  • 557
2 votes
2 answers
2k views

Is it possible to change the tab order of MENU_LOCAL_TASK items on a given page?

I have created a couple MENU_LOCAL_TASK items for my advanced search page in Drupal 6, but they appear at the end of the tab list on the far right. I would like my new items to appear first in the ...
skålfyfan's user avatar
0 votes
1 answer
154 views

$node->form_id doesn't exist? [closed]

function mymodule_node_insert($node){ if($node->form_id == 'whatever_node_form'){ // do stuff } } Returns an error: Notice: Undefined property: stdClass::$form_id in ...
emc's user avatar
  • 863
1 vote
1 answer
1k views

Fetch content from another website into a new one

I want to fetch content from a website into another website. When I edit that content, it will automatically display changes. I am using Drupal 6. Does anybody have an idea about I can achieve this?
Hitu Bansal's user avatar
1 vote
3 answers
1k views

Get the node ID from the "node/add" menu item and hook_form_alter()

I want to set a unique 7-digit code to a custom content type and display it in a disabled textfield when a node is created. I created a CCK textfield and set it to disabled in hook_form_alter, great. ...
emc's user avatar
  • 863
3 votes
1 answer
597 views

Add a class to a row in a view

i'm trying to create a module that adds a 'new' class to a row based on the date it was published. So i thought of doing something like if ($data > 10 days ago){ $this_row addclass new } But ...
dazz's user avatar
  • 1,014
0 votes
3 answers
5k views

Menu local tasks and hook preprocess

I just want to remove a secondary menu local task from a preprocess function such as function mymodule_preprocess_menu_local_tasks(&$vars, $hooks) { $vars['secondary'] = ''; } I'm using D7, ...
Sithu's user avatar
  • 4,953
2 votes
1 answer
44 views

Intelligently altering URL's

I have a dilemma. For my articles content type, i'm wondering how to alter a url automatically if i need to replace the hyperlink of my image thumbnails residing on my site to link to my other site ...
vaeros's user avatar
  • 67
0 votes
3 answers
2k views

How do I create a custom Drupal 7 login?

On my site there are 3 types of users: Public users who do not need to log in Public users who need to log in in order to access documents (pdfs, excel, etc) Users who maintain the web site (add, ...
aausa1983's user avatar
0 votes
1 answer
97 views

Adding items to another Modules Admin form

I have a module that I need to add a few items to, I was told that using hook_form_alter was the best way to do this, but have been completely unable to get anything to work. Maybe some one could help ...
ehime's user avatar
  • 181
0 votes
1 answer
316 views

Drupal override search form: how to debug hook failure?

In the past I've always been able to override the theme form using the method mentioned http://drupal.org/node/154137. function YOURTHEME_form_alter(&$form, &$form_state, $form_id) { if (...
jvc26's user avatar
  • 551
0 votes
1 answer
242 views

Drupal Commerce default amount before adding a product

I want that the Drupal Commerce module checkout by default starts with one specific product , whether you choose another product or not. Is this possible to achieve this by building a rule? Which ...
Jaja's user avatar
  • 31
2 votes
1 answer
606 views

hook_menu() (edit) not working

I am doing something wrong and am not able to find what. I have defined the hook_menu for my module, add and delete are working fine, but edit and view are not. Is like are never being called. ...
Xavi Colomer's user avatar
1 vote
1 answer
352 views

Custom widget making field invisible

I'm trying to create a custom module for Drupal 7 that makes two widgets available for Text fields. The widgets are showing up in the list of available widgets, but when I select one of them as the ...
BenjaminRH's user avatar
7 votes
1 answer
3k views

How do I make the custom module "Configure" option appear on the module list?

I have written a simple module that implements hook_menu() (the added path is admin/settings/mymodule"). On the admin/modules page which lists all the present modules, there is no "Configure" link ...
camcam's user avatar
  • 2,111
4 votes
4 answers
5k views

Set a main-menu item as active with custom code

I want to set a menu item of the main menu as active (class="active"). I'm specifically looking for a hook or function, not a contrib module. I have seen recommendations for Context, and I have ...
rekire's user avatar
  • 355
1 vote
1 answer
75 views

Module enhancement file

Hi guys (and gals) I'm trying to create a simple enhancement to one of my modules .inc files and am messing something up somewhere, and was hoping someone with sharp eyes can point it out. Even though ...
ehime's user avatar
  • 181
2 votes
1 answer
94 views

How do I change the field title on the "Generate automatic URL alias" checkbox in pathautho?

How do I change the title of the checkbox "Generate automatic URL alias" on the pathauto fieldset on the node add page? In my hook_form_node_form_alter I don't see this anywhere in the $form.
Justin's user avatar
  • 3,703
2 votes
1 answer
1k views

hook_mail_alter() - how to access the "contact admin" form fields?

In Drupal 7.10 I have the /contact form open to anyone and would liketo add the Reply-To header to the mail message. How do I get the value of the e-mail address field in the /contact form - both for ...
Alexander Farber's user avatar
3 votes
1 answer
2k views

How to alter the languages available in a form

I have a multilanguage site. When I go to edit a node, all the languages of the site are available. I only want some of the active languages to appear in the dropdown for certain users (for various ...
Apemantus's user avatar
  • 567
0 votes
2 answers
142 views

Hook not getting called (image_title module)

I'm attempting to use the image_title module to replace a node's title by an uploaded image. I thought it was working, but I've since discovered that it was only showing for me, not for anyone else ...
Ken Williams's user avatar
5 votes
2 answers
5k views

File upload hook - how to integrate existing file manipulation code into Drupal

I want to create a waveform image for every mp3 file I upload in a Drupal 7 website (as admin), and store it as a png for display in the frontend. I can use this script in order to do that. I want to ...
whonoes's user avatar
  • 153
15 votes
2 answers
3k views

If two modules both defined the same menu path in 'hook_menu', which one Drupal will choose?

For example, "moduleone" defines the path 'admin/hello', which output print_moduleone_stuff(). /** * Implements hook_menu() */ function moduleone_menu() { $items['admin/hello'] = array( '...
gilzero's user avatar
  • 6,037
2 votes
3 answers
958 views

List of D7 contrib modules that create and use custom tables with full Views 3 support

I'm trying to understand how to properly use Drupal 7 and Views 3 to retrieve data from a completely customized MySQL table. There are several tutorials for Views 2 and Drupal 6 (Scratching The Itch: ...
Citricguy's user avatar
  • 7,924
7 votes
2 answers
7k views

How to override/implement a module's hook

Is there a possible to override a module's hook? What I want is, write a search__query_alter() hook to restrict search results. But to achive this, I should write the hook in built-in module search's ....
Shafiul's user avatar
  • 1,226
2 votes
2 answers
170 views

How to change the language of inserted or updated paths to LANGUAGE_NONE using a module?

All path aliases are entered by hand. I need them to be language independent. Currently they are created/updated in the language that the user is currently using which does not make sense in case of ...
camcam's user avatar
  • 2,111
3 votes
1 answer
149 views

How should I fix an incorrect query in hook_update_N()?

I made a new release of a module, and soon afterwards an issue was filed that the hook_update_N() used SQL that didn't work on PostgreSQL. In this situation I can see two solutions: (Let's say the ...
Andy's user avatar
  • 4,996
3 votes
2 answers
2k views

hook_menu() wildcard problem

I can't get the wildcard from a hook_menu to pass it to a callback function Here is what I have: function spin_menu() { $items = array(); $items['spin/login/%'] = array( 'title' =&...
chchrist's user avatar
  • 313
1 vote
1 answer
156 views

including forms in hook_view

Is it possible to include forms and have it be submitted when viewing a node type? A good example is the default 'Add Comment' module. When you view a node, there is a link you need to click on to ...
user785179's user avatar
  • 1,009
5 votes
3 answers
2k views

Extra include files for hooks

I'd like to organize a .module file better by putting related hooks in other .inc files. So for example, I'd like to take a bunch of imagecache preset definitions (via hook_imagecache_default_presets)...
ack's user avatar
  • 2,149
0 votes
1 answer
301 views

How to pass multiple objects to hook_view()?

I want my hook_view($node) to display not only the $node, but other fancy stuff too - like a table on the bottom using a while-statement. How can I do this? I am only able to pass one object to ...
user785179's user avatar
  • 1,009
1 vote
1 answer
396 views

Call multiple hook inserts from different modules?

Is it possible for two modules that interact with one another to both call hook_insert()? I have a node type that calls ModuleA_insert() when the user hits the 'save' button. Module B is a custom ...
user785179's user avatar
  • 1,009

1
47 48
49
50 51
54