This hook enables modules to register paths in order to define how URL requests are handled.

learn more… | top users | synonyms

0
votes
0answers
20 views

Why can we not name our wildcards in HOOK_menu()? [duplicate]

Pretty generic question but in D7 when creating a new menu item with a wildcard, why can I not name my wildcards something generic so that the code is easier to understand? E.g. This doesn't work: ...
2
votes
1answer
54 views

Can local actions have multiple parents?

I have a module that I am working on that defines some local tasks and local actions for node pages, eg $items['node/%node/foo'] = array( 'title' => 'Foo', 'page callback' => 'foo', ...
0
votes
0answers
7 views

How to print a link to the ajax-deliverable path created using hook_menu?

I have created a ajax-deliverable path using hook_menu(). Here is the code: function custom_module_menu() { $items = array(); $items['get_mempages'] = array( 'page callback' => ...
0
votes
0answers
14 views

Unable to add tab to Contact form

I am trying to add a tab to the administration page for the contact form. The page appears if I enter the path, but it does not appear as a tab on admin/structure/contact. I can't see what I am doing ...
0
votes
0answers
34 views

how to extend a custom module

I am writing 2 modules, one dependent on the other and both extend the user profile page. The first one is order_history and the other one order_details. The concept is order_history pulls out a list ...
7
votes
4answers
297 views

Should I use t() in a hook_menu's description?

I have always used t() for hook_menus title and description like this: $items['some-path'] = array( 'title' => t('My Page Title'), 'description' => t('This is a description about what ...
3
votes
2answers
51 views

Would redirecting users in hook_menu's access callback have any undesirable effects?

This answer led to a discussion about the best way to redirect a user to a specific page if they shouldn't have access to the page they are trying to access. One option is to set the access callback ...
0
votes
1answer
31 views

Why page call back is not needed in Ajax jQuery Drupal 6?

function example_menu() { $items['example-menu'] = array( 'page callback' => 'get-result', 'access arguments' => array('access content'), 'type' => MENU_CALLBACK, ...
1
vote
1answer
39 views

How add tab menu item with external link to article node content

I want to add an extra tab menu item to article node type. I mean a new menu item beside view, edit and other tabs only in article node. but this tab menu item has external link to another site and ...
1
vote
2answers
24 views

Add .active class when certain view is executed using hook_menu

I have a view that is not related with a menu but I need to add .active class to an element of this menu when the view is shown. How can I alter the element adding a class active?
0
votes
2answers
22 views

hook_menu not producing expected tab structure, problem?

I'm trying to create a tabbed menu system with hook_menu() following the hook documentation and Clive's answer. I am using the following code. /** * Implements hook_menu(). */ function ...
0
votes
1answer
13 views

Hook path in main menu not hold active trail

In custom module names supply_area I've created custom path. function supply_area_menu() { $items['supply-area'] = array( 'title' => 'Supply area', 'page callback' => ...
0
votes
0answers
24 views

Remove disabled menu links from menu settings

I have a multilingual site, and when adding content theres an option to add a menu link. Both languages show up in the drop down selection, my goal is to hide/remove the links that are "disabled" (NOT ...
1
vote
2answers
39 views

It is possible to set up a menu item with hook_menu that points to an existing path?

The accepted answer here by marcvangend explains how to it with hook_menu_alter. His method works, even if you skip step one (the block View). But just out of interest: Can you do this by means of ...
0
votes
2answers
25 views

Show a menu item as expanded if on a certain node type

I have a News menu item, which then has children. I need it to be expanded if it is on a news article page, but not expanded on other certain pages. I'm not sure which hook to use. i've played around ...
0
votes
1answer
16 views

Custom Main Menu Text

I want to generate custom text for one of the buttons on my pages main menu. Basically, if a user is logged in and has a first name defined in their profile it should read "Fist Name" otherwise it ...
0
votes
0answers
42 views

I'm getting 'page not found' when trying to access my custom module

I am working from a pre-existing Drupal 7 install. I downloaded the source files and downloaded a dump of the DB. When I first installed Drupal worked fine. I built a custom module, it was working ...
1
vote
1answer
31 views

Why is menu item for custom module not showing?

I'm new to Drupal and about to write my first custom module ("configurator") with help of the drupal documentation. I've implemented the menu hook: function configurator_menu() { $items = ...
0
votes
0answers
20 views

Make hook_menu() argument as global variable

here's the code from my module: function vasya_init() { // ajax framework drupal_add_library('system', 'drupal.ajax'); drupal_add_library('system', 'jquery.form'); } function vasya_menu() { ...
1
vote
1answer
28 views

Getting hook_menu() to respond to a URN

I have a site that can respond to URNs. For example, I need to be able to serve up a response to http://example.com/urn:myscheme:foo:bar:12345 So, I need a router item that can match against the ...
0
votes
0answers
12 views

Drupal Views Dynamic Pages And Aliases

I have a custom module that reads data from an external database. How can I make a separate page for each item with the alias '/pages/ItemTitle' and content 'ItemContent'? The following is in my ...
1
vote
0answers
47 views

Use ajax class doesn't work correctly

I have a custom module that should makes link open with ajax . the module works correctly in hook_menu , but i want to open some nodes from main menu with ajax by adding use-ajax class . here is my ...
0
votes
1answer
20 views

Manage main menu in module

I have a series of sites that use the same theme. What I'm looking to achieve is to manage the main menu (or a standard menu) via a module instead. Reasoning: Most of these sites will have the menu ...
1
vote
1answer
34 views

Custom Top Admin Menu: Intergrating Permissions

Looking into build a top bar to be used for clients for quick access to edit/add pages. Big question I have is, how do you hook this into the Permissions module in core? Say if I want to allow another ...
0
votes
0answers
56 views

Open nodes from menu in ajax mode

I have a custom module that shows node in ajax mode with hook_menu() . how can i show nodes from menu in ajax mode . here is my code : <?php /** * Implements hook_menu(). */ function ...
1
vote
2answers
29 views

I can't get my module to show up in the Navigation

I'm trying to create a custom module that has a block with a form in it. I'm able to install my module, and even add the block to the content area of the site, showing my form on every page of the ...
0
votes
1answer
34 views

Making menu wrapped in nav tag

I've got problem with making main-menu wrapped in element. I've tried: Using hooks in template.php like: function koko_menu_link_main_menu($variables) { /* For block override */ $output = ...
0
votes
1answer
43 views

I can't get hook_menu() to work

Hi I am running the code on p247 of "Pro Drupal 7 Development", which includes the code below and then defines a form. I have enabled the module and cleared the cache but this isn't showing up in my ...
0
votes
0answers
31 views

Programmatically nest a menu / define a parent relationship in hook_menu?

I have a custom module that created a menu via code, UI and features. It looks something like this: I am writing a new custom module, and with code, I want to add a menu item that's nested / is ...
0
votes
1answer
52 views

Role based menu redirect

Setup: I have a main module (called public) and several sub-modules that extend the support offered by the public module. A sub-module (let's call it sub) functions can be accesed only by users with ...
0
votes
3answers
62 views

specify context on hook_menu drupal

I would like to check if particular node instance exists then load that node. if the instance does not exist, then display message. So far: function MODULE_menu() { $items['ds-some'] = array( ...
0
votes
0answers
43 views

i18n and hook_menu() in a module - how to translate router path

I've configured a clean Drupal 7 site with i18n for multi language, paths prefixed with either en for English and nl for Dutch. English is the default language. Everything translates fine with regards ...
1
vote
1answer
110 views

Menu callback error : Undefined offset: 4 in _menu_translate()

I have created a menu item with form. Everything is working fine, but I am getting the following error message on the menu page. Notice: Undefined offset: 4 in _menu_translate() (line 777 of ...
0
votes
2answers
40 views

Custom template for custom page in custom module in D6

So I know there is a way to specify a custom template for custom content types etc, but if I have a custom module where I am using hook_menu() to add custom pages with a page callback function, how ...
0
votes
0answers
38 views

Why is my tree data link item missing an 'access' index?

In my module's hook_menu(), I got this code: $items['somepath'] = array( 'title' => 'Some title', 'page callback' => 'mymodule_page', 'access callback' => TRUE, 'file' => ...
1
vote
2answers
75 views

Dynamic hook menu to redirect user

I'm trying to essentially create an alias to an entity edit form, but really all I need to do is redirect, but get a Page Not Found error. function kidb_profile_menu() { ...
0
votes
0answers
35 views

Customize CMS menu

I have created a menu from the Drupal CMS (admin > structure > menu). Now I want to change the title of the same programatically. Is it possible, if so how? I have tried hook_menu_alter, ...
0
votes
0answers
56 views

How to override permissions of roles in a custom module?

I want to add some given nodes of type "webform" to different groups (organic groups) by their owners which have the role teamleader.Therefore an entity_reference has to be put to each node which ...
0
votes
1answer
42 views

Is it possible to set multiple permission in hook_permission()?

Let's say I have a custom module. Now I upgrade the module and add some new functionality which is bound to the old functionality. I already have a hook_permission() set in the old version. But now ...
0
votes
2answers
50 views

How to display tabbed menu, created via hook_menu?

I am fairly new to Drupal and still figuring out its inner workings. Currently, I am playing around with creating own modules. I want to create a tabbed menu via hook_menu and display it. ...
2
votes
1answer
198 views

How does drupal autocomplete textfields work?

I am asking this question because I have an autocomplete text field with #autocomplete_path set to a valid working path but key events are not handled by the misc/autocomplete.js file. When the form ...
0
votes
0answers
220 views

Autocomplete text field's key events are not triggered and keydown or keyup function's aren't invoked in misc/autocomplete.js

I created an autocomplete textfield using Islandora form builder module. What it does is use an xml file to define form elements rather than the form array. So the xml text field element looks like ...
0
votes
1answer
38 views

Setting menu weight for “Edit” and “View” items in a node

I am trying to rearrange the order of my menu items for my custom node. Most of the menu items are created programmatically in hook_menu() so I can simply set the weights for those which works great. ...
0
votes
0answers
34 views

How to prevent menu link from overriding hook_menu definition

I have the following item in a hook_menu callback: $items['who-we-are'] = array( 'title' => t('Doctors & Specialists'), 'page callback' => 'whoweare_page', 'access arguments' ...
0
votes
1answer
29 views

Using Views as a report in a custom module

I'm new-ish to module development. I just need to be pointed in the right direction. I have a custom module that I think would benefit from a report. The report should show up in the admin reports ...
0
votes
1answer
41 views

Can't add custom.tpl to my module

I create a custom module that included hook_menu and hook_block_info and ... i wanna add a tpl to this module . here is my code : function hookmenu_menu() { $items['hookmenu'] = ...
1
vote
1answer
116 views

hook_menu title callback on wildcard

I have two pages, the first page 'test' has links to test/%. On test/% I want to have different titles but some how this wildcard and the title callback aren't working properly. /** * Implements ...
1
vote
2answers
173 views

drupal 7 hook_menu not working [duplicate]

have read that to use/intercept URLs in drupal, a module can use hook menu to do the relevant processing. Have tried to implement it according to the needs after seeing the tutorials on Drupal. ...
1
vote
0answers
90 views

Drupal7 Menu item 'title callback' being cached?

I defined a menu through hook_menu, and set a title callback on a menu item, like so: function mymodule_foobar_menu() { $items[SOMEPATH] = array( 'title' => t('Drink'), 'title ...
0
votes
1answer
78 views

Drupal callback :: Less CSS file with variable_get()'s

I am trying to create a custom module that programmatically creates a LESS file. I created a menu callback that is a file. Here is hook_menu()... ...