Closed (duplicate)
Project:
Services
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
12 May 2008 at 06:52 UTC
Updated:
1 Dec 2008 at 21:20 UTC
It would be nice to expose some services on the menu system. I have used the attached patch for communicating the menu structure to a flash menu component.
This services patch exposes the three main menu system functions: menu_primary_links(), menu_secondary_links() and menu_get_menu(). Moreover, it implements a new function menu_service_get_visible_menu, which returns the full recursive menu system structure.
| Comment | File | Size | Author |
|---|---|---|---|
| menu_service.zip | 2.98 KB | ebababi |
Comments
Comment #1
idflood commentedThis menu service has been a great help for me. However, I had bad "href" returned (ex: "node/24" and not the path i had given like "about").
I had to add this line in the last loop to make the href reflect the alias of the menu:
$links[$index]['href'] = ( drupal_get_path_alias($links[$index]['href'])) ? drupal_get_path_alias($links[$index]['href']) : $links[$index]['href'];######
Comment #2
ebababi commenteddevertex, thank you for your constructive comments.
The reason I haven't use the path aliases was to implement the function "compatible" with the Drupal's menu system functions. For the purpose of path aliasing I have created this module.
Probably, the best way is to introduce a new parameter to indicate the return of aliased results.
Comment #3
brendoncrawford commentedHere is a similar patch/module for Drupal 6.
http://drupal.org/node/301259
Comment #4
brmassa commentedguys, its a duplicate issue from http://drupal.org/node/140282 (which patch was already applied)
Comment #5
rpx commentedIs there a way for menu.PrimaryLinks to return the sub-menu items as well?
For example, if my Primary Menu is ...
Home
About Us
-- Who we are
-- How to contact us
Our Services
.. then, when I run the menu.PrimaryLinks service, I only see Home, About Us, and Our Services. The two sub items (Who we are, and How to contact us) do not show up in what is returned.
Perhaps I am doing something wrong. Unsure. Any thoughts?