Questions tagged [routes]

Using a term introduced in Drupal 8, routes are the paths to which modules respond.

Filter by
Sorted by
Tagged with
1
vote
1answer
694 views

Adding Facebook Like-button to the User menu in the top-right corner

Do you think there is a way to make a Facebook Like-button appear in the User menu of Drupal 7, right besides the My Profile and Logout links? UPDATE: I'd like to add the button for my site and the ...
1
vote
1answer
4k views

Adding a span tag to main menu items

Possible Duplicate: How do I insert a <span> </span> tag inside the <a> </a> tag on my main menu I tried the code found in How do I insert a <span> </span> tag ...
6
votes
2answers
5k views

Can you make the hook_menu() item title different from the page title?

I'm building a menu with hook_menu(). When you're building the array for this you specify a title, which is then passed to the page you call and becomes the page title. It's also the menu item's ...
20
votes
10answers
22k views

How do I add a hash link in menus?

Is there a way to add a hashed link in the menu under drupal menu to just make a menu item that jumps down to an anchor or id on the page?
1
vote
1answer
1k views

Wildcards in dynamically generated menu

I'm working on a custom module, and I'm building menu items using entries in a database. These are being cached, and the database is only really updated about once a month. I'm having an issue ...
27
votes
6answers
30k views

How to add module to admin/config page?

I'm working on a module in Drupal 7. I've added a hook_menu implementation: $items['admin/config/content/mymodule'] = [ 'title' => 'MyModule', 'description' => 'Configure ...
2
votes
1answer
763 views

How do I achieve 2 level tabs?

Drupal 6 had an easy way to do this, but D7 doesn't. I asked this question on the drupal.org forums, and I didn't get answer. Am I asking too much? I just want 2 level tabbed main menu where I can ...
1
vote
2answers
5k views

How to create and set a new menu block in some content region, programmatically

I want to create a new menu programmatically add for him some elements and the activate it in some content region as a block. How can I do this programmatically? I know how to add for an existing ...
4
votes
6answers
11k views

How do I insert a <span> </span> tag inside the <a> </a> tag on my main menu

I have asked exactly this question on Stack Overflow, but it makes more sense to ask it here. I'm trying to make the text between my tag not display by wrapping it in a and then styling that. I've ...
5
votes
2answers
4k views

Why does the page callback have two arguments?

function menufun_menu() { $items['menufun/%/bar/baz'] = array( 'title' => 'Hi', 'page callback' => 'menufun_hello', 'page arguments' => array(1), // The matched wildcard. '...
4
votes
3answers
5k views

How do I hide the main menu items?

I have users who are the owners of some nodes, and each node has a menu link in the main menu. Users can only see the nodes they own, and they cannot see other user's nodes. The problem now is that ...
3
votes
2answers
2k views

Menu Management

I am trying to make menu management easy for my clients in Drupal 7. How can I make it so that clients can move links on the menu but cannot delete the top level menu? For example, if the top level ...
2
votes
3answers
1k views

Using node_view() to display a node doesn't print local menu items

When using node_view() to display a node (via return from a function that's called in hook_menu()) the usual View/Edit tabs are missing. Is this expected behaviour?
1
vote
2answers
3k views

How to enable menu link when creating a new node?

I try to enable the menu link programmatically, here is how I do it: function create_menu_link() { $node = new stdClass(); $node->type = 'mytype'; node_object_prepare($node); $...
1
vote
1answer
4k views

I want to modify the drop down menus for Marinelli (a Drupal theme)

I have the Marinelli menu setup in a website I am internal testing. I want to modify the drop down menu (I know it uses jQuery), but I have no idea what to do to show the drop down all nested. In ...
8
votes
1answer
3k views

Custom module with its own menu?

I am in the process of writing my 3rd custom module and this one is my biggest challenge yet. I know how to use hook_menu to generate menu items, and depending on the path you choose determines where ...
3
votes
3answers
717 views

How can I add extra info to my menus?

I have some menus that are managed in the standard Menus module (Drupal 6, BTW). I want to add a checkbox when I'm editing a menu item to control the display of a "New" banner via CSS (by adding a ...
4
votes
3answers
10k views

Taxonomy menu with custom path for taxonomy terms

I am trying to make a taxonomy menu using the Taxonomy Menu module with a custom path for the taxonomy terms. Instead of /taxonomy/term/tid I want /proj/!tid (or ultimately /proj/!term-name but I'll ...
3
votes
2answers
2k views

How to make a MENU_LOCAL_TASK on a user's profile only appear on their profile?

I use logic like this to place a tab on each user's profile page so users can view analytics from the usage of a WebApp: // maps a url to a sub-page of user's profile, url to user's Analytics-...
2
votes
2answers
2k views

default routing of custom module

I'm trying to write my first module and am using the hook_menu to route the pages. The module consists of a multi-step form and two static content pages. /** * Implements hook_menu(). */ function ...
3
votes
4answers
3k views

How to hook theme of the main system menu in drupal 7 to display only some of the elements?

I want to modify the main system menu in Drupal 7. Actually I want to display only some specific elements of the menu and hide some other specific elements, in a given case (which I will implement by ...
7
votes
2answers
3k views

What is the equivalent of theme_menu_item in Drupal 7?

I know that in drupal 6 exist: theme_menu_item, but in drupal 7 there is not. Is there any replacements so that I modify the output for main system menu ? Actually I want to do a kind of filter of ...
2
votes
2answers
3k views

hook_preprocess_page: “node_load() + node_page_view()” versus “%node + node_page_view()”

A basic node (nid "123") exists and a module registered two paths using hook_menu: first/%node second Both page callbacks use node_page_view($node) to display a fullpage view of the node, except ...
4
votes
5answers
3k views

Putting items in multiple places in a menu

I'm trying to set up a menu layout which has two links to /biblio; one under "Researchers", and one under "Staff". This is for convenience, as if you are looking under "Staff", the "Researchers" ...
3
votes
2answers
264 views

Core forum form dropdown empty

In a D6 site, when a user goes to node/add/forum, they find that the dropdown "Forums" just shows "Please choose" but there is nothing in that menu. There is nothing in the PHP error log or in the ...
1
vote
1answer
850 views

Is hook_translated_menu_link_alter() thought to be used only on translated menu links?

Could hook_translated_menu_link_alter() be implemented to simply alter a menu link before it is rendered? Clearly, hook_translated_menu_link() is only invoked for menu items that have been flagged ...
17
votes
5answers
6k views

How do I add an access condition to a menu item?

How can I add new conditions on top of existing conditions that determine whether a menu item is visible? These conditions should not be limited to permissions settings. As an example use case (not ...