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

learn more… | top users | synonyms

0
votes
0answers
15 views

dot character in legacy url breaks routing?

I am doing a site migration and I need to maintain a legacy URL for code redemption for URLs still in the wild. The url format I need to support looks like this: http://oldsite.com/coupon.asp?id=5481. ...
1
vote
1answer
12 views

Nesting Navigation Tabs

In my custom module, I'm defining a menu_item with the type MENU_NORMAL_ITEM. In the default bartik theme, this adds a new navigation tab (next to the Home tab). This is great; however, I need nested ...
0
votes
0answers
2 views

Translating menu item

According to https://www.drupal.org/node/323101, we should not use t() for the title and description of each menu item anymore. I have some menu items listed in Main menu that are generated ...
0
votes
0answers
23 views

Wildcard links in normal menu

Im trying to to generate some links from my custom module that behave like they were a MENU_LOCAL_TASK, but are actually a MENU_NORMAL_ITEM, which reside in a normal menu instead of tabs. The Problem ...
0
votes
3answers
34 views

Can we use Same URL in different hook menu?

I am just learning about hook_menu just the basic stuff about creating module and all. I came across this question in mind but could not find clear answer for this Are we allowed to use same URL in ...
0
votes
2answers
26 views

hook_menu/MENU_CALLBACK access denied

I am using hook_menu() to generate a series of MENU_CALLBACKS for processing data at various points in my sites operations. However, while these work for the admin, when trying to access the pages I ...
0
votes
0answers
19 views

Drupal doesn't output list of children on custom module page

I am on Drupal 7. I want to create a page that lists its children, the same way you see the list of links in 'admin/structure' (Blocks, Content types, Entity types ...). I have modified child 1 and ...
0
votes
0answers
22 views

Custom administration menu created from views

I created several views (with page display) as custom administration pages and I'd like to create a custom menu block to Management menu. I started to develop a very simple module for this task: ...
1
vote
1answer
20 views

Add module-generated pages to Drupal 7's search index

I have a custom module that provides pages via hook_menu(). The page callback returns HTML-formatted output that is then displayed. The information is fetched from an external database, so it is not a ...
0
votes
0answers
36 views

Problem with character encoding ( danish æ ø å ) when using page handler include files in hook_menu().

When I use an .inc file to handle my page output, all the danish special characters (Æ, Ø and Å) shows up as question marks, i.e. they are rendered with the wrong character encoding. This following ...
2
votes
3answers
41 views

Can I Run custom callback in site maitenance mode

In drupal site maintenance mode all custom menu callback is not working. it redirect into site maintenance page. But user/login is working. I need to create menu like user/login. please help me.
0
votes
1answer
20 views

Always expanded menu items not showing up expanded in custom menu

I have a custom menu profile-menu and have configured a block to display that menu. It has four menu items with 'expanded' => TRUE. However, during test runs these expanded menu items do not show ...
0
votes
1answer
22 views

I want to navigate to particular tab on clicking of particular menu item

This is my menu This is my Media page on that I have 2 tabs for that I have used UI Tabs jQuery I'm using Drupal 7 menus i.e main menu, I want when user clicks on the News from the menu item it ...
0
votes
1answer
25 views

Passing an object to hook_menu

I am trying to pass an object from a function to the menu item (Not sure if drupal allows that), I get the following error 'Recoverable fatal error:Object of class stdClass could not be converted to ...
1
vote
1answer
29 views

How to hide my hook_menu items from the navigation menu?

I've got a custom module which I use to define some urls that are used for a json api. I don't want them to show up in the Navigation menu. How do I change my hook_menu configuration so these urls are ...
0
votes
1answer
30 views

Show sub menu via hook_menu

Sorry for asking such a question, but I'm still new in Drupal. I want to show sub menu via main menu. Ex: - Top menu 1) Home a. Report b. Comment 2) Shopping a. Audi b. Honda In this case, ...
0
votes
2answers
23 views

Custom menu items with hook menu

I'm using hook menu here for the first time as token menu doesn't seem to be doing what I need. In the end, I need a menu that will use a wildcard and load a view based on that wildcard. I have the ...
1
vote
3answers
58 views

Render alternative content if user is logged in instead of redirecting to user/uid

I have a menu router with type MENU_CALLBACK and it's 'page callback' property points to a function that implements render API, as follow: /** Implements hook_menu **/ function custom_render_menu() ...
0
votes
1answer
47 views

Entityform - “The form has become outdated.” error

I have an entityform that appears on a page, for some reason the form will not submit ... // implement hook_menu function foiagen_menu() { $items['node/%node/foiagen'] = array( 'title' => ...
0
votes
1answer
26 views

Access denied: 'view published content' permission

When I look into admin/people/permissions: 'View published content' is checked for anonymous users. Yet the following code: function test_menu() { $items['test'] = array( 'title' => 'Test', ...
0
votes
0answers
13 views

Add a link in a menu

I want to create a menu of existing page via hook. I have a module that is called dw_blocks, which contains a hook_menu () In this function, I create a new 'step' menu that works. And now, I will ...
0
votes
2answers
55 views

How do I add HTML to my module's custom admin page?

I have set up a new page in my admin for my module like so: /** * Implements hook_menu(). */ function scraper_menu() { $items = array(); $items['admin/scraper'] = array( 'title' ...
0
votes
1answer
42 views

How to create main links like home ,services programatically? [closed]

I am creating a new website in Drupal 7,but from my past efforts I tried adding main menu links(home,services,clients,blog etc)but all in vain!! Can anyone tell me how to create main menu links ...
0
votes
1answer
24 views

Translate menu with wildcard

I am creating a menu item using hook_menu() and what I want is to translate it when I am using a wildcard, because I have a multilingual site. There is a solution, using t()[, but it's not the best ...
0
votes
2answers
31 views

hook_menu implementation producing error page

I am trying to create a new module implementing hook_menu, to render a page on my company's web site, which I have taken over from the external firm who designed it. There are other modules that use ...
1
vote
2answers
121 views

Hook_menu() and its page callback: how to redirect users on a condition?

I'm trying to redirect users from an existing path in Drupal 7 to another existing path. I want to implement the following rule: comment/reply/123 should redirect to node/123#comment-form But ...
1
vote
1answer
14 views

Add items to router but not links

According to the last paragraph: https://api.drupal.org/api/drupal/includes%21menu.inc/group/menu/7 Everything described so far is stored in the menu_router table. The menu_links table holds ...
0
votes
0answers
36 views

Need advice on how to go about creating a very specific custom menu

I have the need to create a custom menu that is giving me quite the challenge. I have a site that focuses around properties as the main content type. Several other content types have references to the ...
0
votes
1answer
41 views

Override user/%user page callback for a role

I have done this by altering the 'page callback' for the path and then checking for the user role in the callback function. I am not sure if this is the best way to go about it. function ...
0
votes
1answer
44 views

Menu tab with count

I am trying to add a menu tab on the user profile page with the # of blog posts someone has made. Ex: Blogs (3) /** * Implementation of hook_menu */ function menutab_followers_menu() { $view = ...
0
votes
0answers
23 views

hook_menu for organic groups

I have some menus for my organic groups generated by views. But I want to replace them in my custom module and use hook_menu to register the menu for real. But I cant get it to work. All paths used ...
0
votes
1answer
33 views

Custom status message on a Views page

I have different urls : domain.com/blog : a list of articles made with Views module domain.com/blog/article-title : article alias domain.com/newsletter/confirm/add/xyz/ok : confirmation link sent to ...
0
votes
0answers
33 views

Render node with tabs in Drupal 7

If I set up a menu callback with this function: function mymodule_menu_callback($nid) { $node = node_load($nid); return drupal_render(node_view($node)); } Then when the node is rendered it ...
1
vote
0answers
19 views

How do I give access provided user has at least one type of access granted?

I use Drupal 7. My module implements two types of access permissions, named: access MYMODULE foo access MYMODULE bar I want to grant a user access to a particular path (node/%node/MYMODULE) ...
0
votes
1answer
40 views

How to put a link / menu at the top of the edit-user profile page? [closed]

How can I put a link / menu in the edit-user-profile page, in the upper right corner? This link will open a new page with a form created. I've been watching a few examples but I could not ...
0
votes
2answers
74 views

Customising user profile tabs

I've customised the user profile tabs to look like a dashboard by using the generated classes and styling them using just CSS. Just to be clear, I haven't used any hooks or preprocesses to render the ...
0
votes
1answer
38 views

Printing Region With Content in Custom HTML

I am creating a custom first page that is blank and built up from scratch. However I want to print certain regions (e.g. the footer) on this page. How can I grab the region information/content and ...
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
93 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
13 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
30 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
41 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
374 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
135 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
47 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
367 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
73 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
44 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
30 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
1answer
46 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 ...