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

learn more… | top users | synonyms

6
votes
1answer
34 views

hook_menu_alter with Organic Groups

I want to change the menu button on my main nav bar depending if the user is or isn't a member of a group. I need one button to 'register' if the user isn't part of a group and that same button ...
-1
votes
1answer
18 views

Trying to modidy a menu hook_menu_alter

What is the best way to add a link to the user menu for a menu defined in my custom module?
0
votes
0answers
51 views

Change custom block content based on URL parameter

I'm trying to accomplish a certain task and clueless. Im using Drupal 8 for my new project.I have a slideshow in my home page and I've used 'flexslider' plugin and views for achieving this. This is ...
1
vote
1answer
16 views

Drupal 7 hook_menu with a querystring param?

I have a module that loads at path module/1/view and then when user clicks a button they are redirected to another site and then redirected back to the same URL they left from with a querystring that ...
2
votes
1answer
16 views

Menu item with update text (title) in real time

I have a menu where one of the items (menu links) is a link to a view where I can see all comments that I have to moderate. Which I need is (if it is possible) to have the title of this link that ...
0
votes
1answer
8 views

Is it possible to create a menu item with first argument as wildcard?

I have created a menu item using hook_menu() with the following structure.Unfortunately, when i access the given link, it returns not found error? Can anyone give a solution for this? ...
5
votes
2answers
39 views

Ajax %-wildcard URL giving 404 error when setting a parameter

I have a page with a dropdown. When you click on that dropdown that content is loaded by Ajax. I would like to do the same for the Breadcrumb, so I created an Ajax-URL in my module: function ...
3
votes
1answer
35 views

How can I create a Simple page that display the latest node of a content type?

I write a little module for loading the content via ajax(one of the used tutorials) and now I need a page for the first visiting(front page). I don't want to do this with Views and looked around, but ...
0
votes
1answer
37 views

fastest between hook_js vs hook_menu to get JSON via REST

I'm trying to figure out if in my case it makes sense to use the High-performance JavaScript callback handler module. Between js/MODULE/example.json (hook_js()) and example.json (hook_menu()), the ...
0
votes
0answers
16 views

Add a node with its available translations as menu item in main menu

I have the default drupal main menu and i want to add a specific node as parent menu item and its available translations as sub-items (children). When a new translation added i want to be inserted ...
0
votes
0answers
29 views

Can I use menu path with argument wildcard in Views?

I have Views profile list displayed as page. View path is 'mymod/%mymod_param/foo'. According to docs I can set wildcard value by a function (hook_menu) Function to set url param: function ...
3
votes
1answer
41 views

Ajax best practise for custom links

I was reading up on AJAX requests in Drupal 7 at http://codekarate.com/blog/drupal-7-javascript-ajax-framework-example-link Where the AJAX framework is explained in detail, when used on custom links ...
0
votes
1answer
27 views

Pass URL to menu item call back

I'm implementing hook_menu to add a new tab to the user account page. I'd like to pass a URL as the page callback (a local URL for an existing page on the site). the page_callback parameters just ...
1
vote
2answers
25 views

Can visit the page but can't see the tab it should have

Not sure how to word it and I am sure plenty of other people have run into this problem, so I apologize in advance. I have the following code: function content_type_message_menu() { $items = ...
0
votes
1answer
22 views

User menu tab content

On the /user page i've created two tabs: function hook_menu() { $items['user/%/My-Courses'] = array( 'title' => 'My Courses', 'type' => MENU_LOCAL_TASK, 'page ...
0
votes
0answers
11 views

How to view a menu item and how it looks before a content is set to published?

We are having difficult time figuring out a way to preview the menu before we publish a piece of content. We are currently using Workbench and have four publishing states (draft, needs review, ...
0
votes
0answers
20 views

Render webform node on page callback with view, edit, webform, result tabs

I have a setup where I direct authorized users to a profile2 page or render a webform to anonymous users, using page callback in hook_menu_alter . I want the admins to be able to access the webform ...
0
votes
2answers
34 views

Override tpl for custom menu page

I have created a custom menu with hook menu booking/%/reschedule and where % is nid of bookings ( content type ), I want to override tpl file for this page in my theme. I tried with ...
0
votes
1answer
31 views

How to get URL parameters values inside access callback

I have a link looking like this: members/get-certificate/<user_id>/<group_id>/<pass date> The access callback should work like this: if($user->uid == <user_id>) { ...
0
votes
1answer
30 views

Go to previous page (not after form submit)

I have a function that is called by hook-menu item an is accesible from different subpages of the site. This function does not return any html, it just do some database inserts and should redirect ...
0
votes
1answer
345 views

Create a form programmatically and display result on template

I'm trying to create a simple page with a form. With the different filled fields I want to execute different EntityFieldQuery in the HOOK_form_submit. To finish I want to display the result of ...
1
vote
1answer
28 views

Alter menu link for taxonomy link

I've path alias and taxonomy menu. Now menu displays taxonomy link as vocabulary_name/term_name. For example, my vocabulary name is 'category'. I want to change into 'article'. I've to only for this ...
0
votes
1answer
27 views

Show menu only when user ticks the checkbox

I have a menu for user to enter user details which should visible only to logged in user, it works fine. Now I want to add another restriction where I want menu to be displayed only to the user who ...
0
votes
2answers
41 views

Hook menu item not Showing

I have two hook menu items: function myid_print_menu() { $items = array(); $items['user/%user/myid_print_settings'] = array( 'title' => 'ID Print Settings', ...
1
vote
1answer
32 views

Global Filter as main menu drop down link

I'm looking for right steps to implement Global Filter module not as a block, but rather as an main menu links. The biggest problem is that each user can see only links they have access to (taxonomy ...
0
votes
3answers
92 views

drupal_add_js not working

I have this code in my javascript: (function ($) { Drupal.behaviors.myid_print_table_id_link = { attach: function (context, settings) { $.ajax({ type: 'POST', ...
2
votes
3answers
456 views

My hook menu is not working

I get a 404 when going to the page... domain.com/workingmodule. My module is turned on, and I have tried clearing the cache. Here's my code: /** * Implements hook_menu(). */ function ...
-1
votes
1answer
28 views

problem getting hook_menu() to work

I want to display a button on the front page of my website and for the first time (as beginner), I wanted the link to be configured in the administration page. I followed the tutorial on creating a ...
1
vote
1answer
66 views

How to add a menu tab programmatically to a views page?

I have a view page showing fields of an entity. The pages URL set in Views is entity/% Now I would like to add some tabs to this views pages that I can't generate with views it self, but have to ...
0
votes
1answer
27 views

How to hide tabs, depending on the role of editing using menu_alter

I have 3 types of accounts: Admin, Student and Tutor. After I turned on the path user / %user / edit / tutor, I see two tabs editing: Student and Tutor. But I want to only display the tab tutor when ...
0
votes
1answer
44 views

Pass $form and $form_state as arguments in hook_menu

I have a javascript code below: $.ajax({ type: "POST", url: "?q=myid_print/update_table", }).done(function(o) { console.log(o); }); ...
4
votes
1answer
47 views

How can I override a module's file via hook_menu_alter()? [closed]

I have the following code in my hook_menu_alter(). <?php function bonus_menu_alter(&$items) { if (!empty($items['things'])){ $items['bonus'] = $items['things']; ...
0
votes
2answers
46 views

Displaying hook_form

I have implemented a hook_form in my custom module and I can't figure out how I can get the form to display. Here is my hook form: function data_retrieval_form($node, &$form_state) { ...
1
vote
0answers
101 views

Programmatically add dropdown to administration toolbar

I'm trying to add a dropdown menu to the administration toolbar for my custom module but it is not appearing. I have flushed the cache and disabled/renabled the module but with no avail. I am using ...
0
votes
2answers
31 views

Retrieve argument in hook_menu() item url

On my custom module, I defined the following hook_menu() function. function motel_events_menu() { $items['ajax/pastevents/%'] = array( 'title' => 'Get Past Events', 'page ...
1
vote
1answer
31 views

JSON Menu Link Without Invoking Init Hooks?

Our Drupal site utilizes a number of menu hooks to return JSON from an API we manage in a separate Web API. We also have a number of intensive tasks that happen on each page load via the hooks_init in ...
1
vote
1answer
26 views

hook_menu drupal 7 shows in menu but not show page [closed]

I made module, and want to add settings page. Menu Item appear in settings dashboard, but when try access page it display dashboard with menu items again, thought URL is correct. return array( ...
2
votes
2answers
104 views

PHP require_once() warning with hook_menu

I'm writing a small module for learning purpose, where I try to create a module settings form using hook_menu() and form_api. Everything look good in my code but I still getting this error message : ...
1
vote
1answer
29 views

How do you go about using contexts and a menu page callback?

Currently we have a page that is generated by a hook menu page callback. The path is structured like menu/%location_name/menu/%parent_category/%child_category. The function requires at least one of ...
-1
votes
1answer
65 views

Custom 404 error page issue

I want to have a custom 404 page that displays some additional information. I need to display the requested path that was not found and some pages suggestions based on that path (this is based on some ...
0
votes
1answer
37 views

Create node display custom tab

I'm trying to create tab in node display that links to node delete form. I used hook_menu_local_tasks_alter in template.php function mytheme_menu_local_tasks_alter(&$data, $router_item, ...
0
votes
1answer
54 views

Hook menu - title arguments

I have those menu elements declared in hook_menu function: $items['submission/%/id/%'] = array( 'title' => 'View submission', 'title callback' => 'fr_form_view_submission_page_title', ...
0
votes
1answer
32 views

menu item call from tpl file

I have create one form in .tpl file with simple html form tag. In action attribute of this form element i passed a url like 'action=savequestion'. Now in my .module file, inside hook_menu(), I am ...
0
votes
1answer
21 views

How do I effect the page that a menu item redirects to?

I am trying to do something that seems simple, but I have yet to have to do it with my development because I have always dealt with forms and views. On the page that I get redirected to when I click ...
1
vote
1answer
33 views

How to handle a post request from an external application in Drupal?

I am integrating with the Stripe payment gateway and I need to be able to handle a post from their server to authenticate a standalone account. I am trying to follow the instructions at ...
0
votes
0answers
24 views

Drupal ajax nav with friendly URLS

Im stuck on this... :-/ heres the problems im facing: The site navigation links should be in the form of: url.com/final-page I've managed to build out a ajax navigation module using a few ...
1
vote
0answers
50 views

menu page callback cache expiration, headers

Drupal 7, custom module to output data in JSON format. Task: create cacheable page that prints string in JSON format. function examplemod_menu() { $items['json'] = [ 'page callback' => ...
0
votes
0answers
34 views

How to call a Load function or (Auto-Loader Wildcards) of hook_menu() that is defined in external .inc file

We can define a callback function of hook_menu() in external (.inc) file but I have defined an AUTO-LOAD function in external (.inc) file then it is not working but if I defined in .module file then ...
0
votes
1answer
53 views

Add a link in management menu for specific role

I can't find the way to display a link in the management menu for specific roles. The link shows up only for administrator, despite all the access callbacks I tried. In the view displayed by the ...
0
votes
1answer
47 views

Menu access callback function called multiple times

I have following menu defined with access callback function. As You can see this is a hack so I can use REST via GET ( normally Services do not offer this ). All my endpoints are defined ...