[code]
$items[]= array('path' => 'node/'. $node->nid .'/results/oma', 'title' => t('oma'),
'callback' => 'webform_my_function',
'access' => user_access('access webform results'),
'weight' => 9,
'type' => MENU_LOCAL_TASK);
[/code]
I'm working with Webform module. I'm adding a custom link that calls a custom function called webform_my_function. When I navigate to url /results/oma Drupal doesn't call webform_my_function() which was my goal.
However, I if change callback to 'webform_results' ( a function already defined in the original webform module) and then modify webform_results to call webform_my_function everything works.
I need a helping hand here, why I can't use my own function directly in hook_menu??
Comments
Any suggestions on this
Any suggestions on this problem?
Is it because of the Webform module or do I lack some essential information about the module customization?
I have been searching answers from here:
http://www.ibm.com/developerworks/ibm/osource/implement.html?S_TACT=105A...
part 6 deals with building custom modules. I have understood that that article is about Drupal 4.6 or 4.7. So, I don't know if I have got something wrong..
Any help would be appreciated!
Hello. Did you solve this
Hello.
Did you solve this problem? I think it was because your url match with one of another pathes which were enabled by module. So your function can be passed directly in hook but you must set path to something that will not be matched with something else.
Hook Menu
You normally create your own module file listing called MYMODULENAME.module. You'd place the hook_menu() implementation the MYMODULENAME.module file listing.
Use the Drupal Admin Performance function and clear cache. That will force Drupal to recognize your new menu callback.
You point your web browser to http://MYSITE/results/oma to invoke your custom function (webform_my_function()). I changed the access arguments to something really basic just to help you isolate the issue.
An overview of how the Drupal function mapping (menu) works is located here:
http://api.drupal.org/api/group/menu/6
If you need to pass arguments to your custom function expand the hook_menu() implementation to something like:
Hope that helps.