aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--finder_menu.module42
1 files changed, 25 insertions, 17 deletions
diff --git a/finder_menu.module b/finder_menu.module
index d3d6a5a..5e9b627 100644
--- a/finder_menu.module
+++ b/finder_menu.module
@@ -2,6 +2,12 @@
// $Id$
/**
+ * @file
+ *
+ * Implementation of a Finder Dropdown Menu.
+ */
+
+/**
* Implementation of hook_init().
*/
function finder_menu_init() {
@@ -56,23 +62,23 @@ function finder_menu_theme() {
* Generate the menu.
*/
function theme_finder_menu($menu_name, $mlid) {
- $item_class = "finder-menu-menu-item";
+ $item_class = "finder-menu-menu-item";
$sub_item_class = "finder-menu-sub-menu-item";
-
+
// Find menu item in the menu tree
$menu_tree = menu_tree_all_data($menu_name);
$menu_link = menu_link_load($mlid);
-
+
if ($mlid != 0) {
for ($i=1; $i<10; $i++) {
- foreach($menu_tree as $menu_item) {
+ foreach ($menu_tree as $menu_item) {
if ($menu_item["link"]['mlid'] == $mlid) {
$menu = $menu_item['below'];
break 2;
}
else {
- if ($menu_item["link"]['mlid'] == $menu_link['p'.$i]) {
+ if ($menu_item["link"]['mlid'] == $menu_link['p'. $i]) {
$menu_tree = $menu_item['below'];
break;
}
@@ -91,29 +97,29 @@ function theme_finder_menu($menu_name, $mlid) {
}
// Backup active menu trail and set a new one
-
+
$active_menu_name = menu_get_active_menu_name();
menu_set_active_menu_name($menu_name);
// Build table of mlid in the active trail
-
+
foreach (menu_set_active_trail() as $value) {
if ($value['mlid']) {
$trail[] = $value['mlid'];
}
}
-
+
// Restore active menu trail
menu_set_active_menu_name($active_menu_name);
-
+
// Build the menus
-
+
$output = '<div id="finderparent">';
$output .= finder_menu_build($menu);
$output .= '</div>';
drupal_add_js(drupal_get_path('module', 'finder_menu') .'/finder_menu.js');
-
+
return $output;
}
@@ -124,14 +130,15 @@ function theme_finder_menu($menu_name, $mlid) {
*/
function finder_menu_build($menu) {
- global $finder_menu_id;
+ global $_finder_menu_id;
- if ($finder_menu_id == null) {
+ if ($_finder_menu_id == NULL) {
$output = '<ul id="finder" class="hidden">';
$output .= implode((array) module_invoke_all('finder_menu_build'));
$finder_menu_id = 0;
- } else {
- $output = '<ul id="finder[ul][' . $finder_menu_id . ']" class="hidden">';
+ }
+ else {
+ $output = '<ul id="finder[ul]['. $_finder_menu_id .']" class="hidden">';
}
foreach ($menu as $menu_item) {
@@ -139,9 +146,10 @@ function finder_menu_build($menu) {
$output .= '<li>';
if ($menu_item['below'] !== FALSE && finder_menu_has_unhidden_submenu($menu_item['below'])) {
$output .= $menu_item['link']['title'];
- $finder_menu_id++;
+ $_finder_menu_id++;
$output .= finder_menu_build($menu_item['below']);
- } else {
+ }
+ else {
$output .= theme('menu_item_link', $menu_item['link']);
}
$output .= '</li>';