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

learn more… | top users | synonyms

0
votes
0answers
2 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
18 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
20 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
15 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 ...
-1
votes
0answers
25 views

Module doesn't work

For some reasons, for whatever module I create, even a 'hello world module' I can't access the link to the page I create with the module. I cleared the cache already, activated the module and ...
0
votes
1answer
26 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
17 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
47 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
36 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
19 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
11 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
41 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
37 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
17 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
29 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
45 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
13 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
32 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
28 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
41 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
16 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
31 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
27 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
16 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
35 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
65 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
30 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
84 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
12 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
40 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
343 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
102 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
46 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
200 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
56 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
37 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
24 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
39 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
53 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
35 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
0answers
18 views

Custom Main Menu Text [closed]

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
52 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
68 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
31 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
33 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
19 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
76 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
23 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 ...