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

learn more… | top users | synonyms

2
votes
1answer
28 views

array_flip() error while creating a menu item with form

My aim is to create a new menu item and display the user profile form on that page. Here is the code I am using. /** * Implements hook_menu(). * */ function profile_preferences_menu(){ ...
0
votes
0answers
17 views

Adding query to dynamic menu item with _to_arg()

I have a custom menu item that attempts to use a _to_arg function to dynamically add a query to the url. In the _to_arg() callback, whether using the url() function or passing back a plain string, I ...
0
votes
0answers
13 views

Module config page linked in admin toolbar

I created a config page for my new module. Whenever I enable the module, a link to the config page is added to my administration toolbar across the top of the screen as well as a configure link next ...
0
votes
1answer
26 views

hook_menu not available for ajax loaded links

I'm loading a datatable and its data into a panel, through ajax. Below is the link which can add the row(entry) to favorites. When I click the link, the jquery animation is executed properly but the ...
0
votes
0answers
14 views

How to pass a url as a hook menu argument

I need to send a url as a variable in path e.g. 2 arguments. The 2nd argument would need to be a url so http://www.blah.com. However, at the moment even if I use urlencode (which produces ...
0
votes
2answers
74 views

Create custom variables for a template file inside a menu callback function

here is a good one that has always stumped me. I would love to see a solution in both D6 and D7. I create custom modules and usually work with the menu api to create menu type -> MENU_CALLBACK. ...
0
votes
1answer
23 views

Login Users action in, $action_links, how do i edit it?

I am still very new to drupal and have let to use all the hooks and coding needed to do everything, now I have come up with a problem, which I can not seem to fix either with a module or by looking at ...
1
vote
1answer
39 views

trouble with hook_menu

I am trying to set up a new menu item in Drupal 7 and not having any luck. I've tried several examples and have been successful at this in the past, but this is just not working. The following code ...
0
votes
3answers
63 views

Drupal 7 - Add two menu items with the same path but different query string

On Drupal 7, there is a difficulty adding two or more items to a menu which are having the same URL but a different query string. For example, when I add two similar paths: ...
1
vote
1answer
40 views

Problem adding a tab to the user menu

I created a panel page using the Panels module, Contact list at the path messages/contact-list. The Privatemsg module causes several tabs (Inbox, Sent messages, All messages) to be displayed across ...
0
votes
1answer
33 views

Intermittent hook_menu error - call_user_func_array() expects parameter 1 to be a valid callback

As the title suggests I'm getting intermittent errors when hook_menu is called. Based on the error message it's as if the callback can not be found. Clearing the cache resolves the issue and the page ...
0
votes
1answer
34 views

Custom Menu Form Node Creation

I have been going over posts and examples for hours but finally need specific help on where my code is broken. I'm trying to create link in navigation that opens a form to create a new node. However ...
0
votes
0answers
13 views

Specifying the page URL for secondary language

I have a menu item added with hook_menu: $items[$word_page_path] = array( 'title' => 'Thank You Wall', 'page callback' => 'wow_page', 'access arguments' => array('access ...
0
votes
0answers
65 views

Function hook_menu() does not work: Callback function not found

I want to use the function hook_menu() for a custom menu item with following code: function custom_api_menu() { $items = array(); $items['new/task'] = array( 'title' => 'New task', ...
1
vote
1answer
25 views

how to alter main menu to add custom class

How do I add custom class to main menu. The main menu links are like Fashion, Art, Life and nodes being viewed category can be any one. I want to make the main menu item active as per node being ...
0
votes
1answer
17 views

drupal hook_menu incorrect affect menu_rebuild - where see the log

When I try to create view, and also something else, the menu could not be rebuilt well, and can not access the view page... at all. After long time effort, found out that my module did not do well on ...
0
votes
0answers
20 views

How to link to latest taxonomy term page from menu?

Apologies in advance for the newbie question, I'm just starting to work my way around the D7 API. I'm trying to create a link in my Drupal 7 main menu which will always link to the most recently ...
0
votes
2answers
123 views

Custom module menu path renaming/redirection

Is it possible to create path like subdomain for custom module menu? For example create url like xyz.example.com if path is example.com/xyz where xyz is custom module menu. I've already tried to use ...
0
votes
0answers
23 views

Create menu and set it to sidebar region via custom module?

Trying to get my head around how I can create a custom menu (with menu links) and then set this menu in sidebar (replacing the other menus that might be there) in a custom module? I want the custom ...
1
vote
1answer
55 views

Override theme function for menu callback

What I am looking for: I have a custom node link which, when clicked, displays a custom HTML content (option selections) in a lightbox. I need to pass an argument to the HTML content to generate the ...
0
votes
0answers
23 views

menu page not found

I am in Drupal 7. Somehow the menu call back not working. Even I reduced to this simple testing. It always says: The requested page "/page/page" could not be found. function mymodule_menu() { ...
0
votes
1answer
39 views

hook_menu how to render the layout

function test_menu() { $items['test'] = array( 'page callback' => 'test_test', 'title' => 'test', 'menu_name' => 'navigation', 'type' => MENU_NORMAL_ITEM, 'access ...
0
votes
1answer
47 views

Multiple forms/pages in one hook_menu()

Within hook_menu(), I added multiple (form/page)s. function mymodule_hook(){ $form[...]=aray(...); // ... return $form; } function other_hook_form(){ $form[...] = aray(...); // ... ...
3
votes
1answer
41 views

How do I add a menu router that works even in the maintenance mode?

when a Drupal site is in maintenance mode (not due to a technical fault), users without permission cannot access any page other than /user. Is there any special hook to define a specific menu router ...
0
votes
1answer
53 views

hook_menu and Access Denied

Why do all of these menu items return "Access Denied" pages no matter how many times I drush cc all and clear cache from admin/config/performance? /** * Implements hook_menu() */ function ...
2
votes
2answers
33 views

my D7 batch is running with every request to anywhere on my site

I'm writing a batch module and for some reason every time I load any page on my site, the batch is running. The other weird thing that may be related is that the $context['sandbox'] is not being ...
1
vote
3answers
128 views

What is the difference between hook_menu(), hook_menu_alter(), and hook_menu_link_alter()?

So, I am fairly new to Drupal (about 8 months in) and I am using Profile2 with 3 different profile types. Everything is working excellent, except for I wish I could wrap my head around how I can ...
0
votes
2answers
76 views

how do I create submenus in my module?

I am pretty new to drupal php etc. I have a module that just add links to main menu and load a .html and a .js when a link is called. For now my menu looks like this: Demo Now I would like ...
0
votes
3answers
61 views

Display view on custom homepage

I have a site with custom home pages depending on role. The homepages are assigned with hook_menu (hook_menu associates a URL with a function that returns a $html string.) For one particular role, ...
0
votes
0answers
27 views

How to pass values from a page to another one [duplicate]

I have a menu page contains 3 form fields: gmail email (textfield) gmail password (textfield) Submit button (submit) This page is used to collect user input, and pass it to another menu page. ...
13
votes
1answer
289 views

How to implement hook_menu?

What are the fundamentals of implementing the hook_menu hook? I would like to see the basics covered in a single question, to avoid having to answer the same similar but different questions over and ...
1
vote
2answers
75 views

Bypass drupal theme with hook_menu() function?

I have a page within Drupal administration where I want to bypass all of the normal Drupal theming and calculations to only show the HTML that's returned by the function. Is this possible? ...
1
vote
2answers
92 views

Remove an item from “menu local task”

I need to remove "Create new account" from the tabs on /user page. I was suggested to use hook_menu, but: It seems that hook_menu can only add, not remove items. hook_menu does not work for me as I ...
0
votes
2answers
68 views

Why my hook_menu does not work?

I have this code in the module cleanetica_advanced. function cleanetica_advanced_menu() { $items['ajax/content/%'] = array( 'page callback' => 'cleanetica_advanced_ajax_load', 'page ...
2
votes
0answers
38 views

Menu Wildcard Argument Displays in Breadcrumb

So, I have a menu setup in my module like the following. I have omitted most of the definition parameters to be brief: $menu = array( 'admin/config/people/MY_MODULE' => array( 'type' ...
1
vote
1answer
44 views

Using hook_menu to add a child to a menu item

So I create a menu item called Sponsorship in administration in the following way: function eac_sponsorship_menu() { $items['admin/sponsorship'] = array( 'title' => 'Sponsorship', ...
0
votes
2answers
57 views

Splitting up the .module file

I wrote my first module which happens to be in Drupal 7. The module uses hook_menu to correlate URLs with three custom-coded, page call backs. These callback functions that construct the custom html ...
0
votes
2answers
32 views

Override menu item weight (bring it to same level as 'user' link) that has user/% path and has to be in user-menu

I need a menu item living in the user-menu, has path like 'user/%something' but i dont want it to have "My account" link as parent (that has path 'user') i can only change that through the ...
0
votes
0answers
25 views

Case sensitive Menu Hooks

I was checking the access logs and could spot that most of the pages were linked from other sites with different cases. node/add is same as NODE/ADD and all combinations of upper case + lower work. Is ...
0
votes
1answer
164 views

Display hash anchor tags into drupal 7 menu items without modifying hooks or adding modules?

currently when path url in menu items are set to: node/1#anchor the anchor is removed. How would you solve this?
0
votes
1answer
52 views

Page not found - Even after I implemented Hook_Menu()

I have implemented hook_menu() & called a function, but if I am trying to browse the page URL it's giving me "Page not found" error... This is the code -- function user_type_registration_menu(){ ...
0
votes
1answer
474 views

Drupal 7: Modifying the view page and edit form of a content type programmatically

a Drupal newbie here trying to create his first module for Drupal 7. In my site I've created a new content type (machine name: abstract) from the site's admin's front-end. A user can add a new ...
0
votes
1answer
18 views

Echoing admin menu child items

When you click 'Structure' in Drupal admin the page displayed is a print of the child items of the 'Structure' menu item. I imagine this behaviour is relatively simple to achieve? I have a custom ...
0
votes
2answers
57 views

Finding menu item ID

How to find a menu item pointing to the specific node? On node creation I want to create a main_menu link for the node. With menu_rules it is relatively easy. The problem arises when the parent ...
0
votes
0answers
63 views

Hooks menu and theme return html to append

i have an item on menu hook callbacking a function, this function return a theme (a short html) to append on page via ajax/jquery but the returned html, have basic theme elements like body footer and ...
2
votes
1answer
80 views

Adding a page to a menu with query parameters in the URL

I'm trying to add a page generated by CiviCRM to my menu. The pages url is 'civicrm/contribute/transact?reset=1&id=6'. I've added the link to the drupal menu manually, and it goes to the page, but ...
0
votes
1answer
32 views

How can I distinguish dynamic pages on a hook_menu?

function mymodule_menu_local_tasks(&$variables) { if ( request_path == 'yadda') : .... } I can do that.. but the problem is I want to include this for the tabs on user/$id/edit and I'd ...
0
votes
1answer
18 views

Print taxonomy information based on the link that is clicked

Lets say I have a taxonomy called fruits. I have 3 links on my front page and the href-s are: fruits/bananas fruits/oranges fruits/apples I made a custom module to do this but I am not really sure ...
-1
votes
1answer
51 views

How do I load a HTML file within a custom module? [closed]

function onthisdate_menu() { $items = array(); $items['test2'] = array( 'title' => 'Test route', 'description' => 'description of test', 'access callback' => TRUE, 'page ...
1
vote
1answer
97 views

Access denied for admin?

Why when I am logged as admin I get an access denied page, the page is custom like mysite.com/test - added by the custom module: function onthisdate_menu() { $items = array(); $items['test2'] = ...

1 2 3