'menu', 'module' => 'navigate_menu', 'content' => navigate_add_widget_link('
', 'navigate_menu_load'), ), ); case 'delete': break; } } /** * Generate menu widget */ function navigate_menu_widget($wid) { $settings = navigate_widget_settings_get($wid); if (!$settings['mid']) { // Generate a list of possible parents. $options = menu_parent_options($item['mid'], variable_get('menu_parent_items', 0)); $form['menu'] = array( '#type' => 'select', '#options' => $options, '#parents' => array(), ); $inputs['menu'] = drupal_render($form['menu']); $inputs['load'] = navigate_callback_button(array( 'class' => 'navigate-menu-load', 'callback' => 'navigate_menu_load_menu', 'content' => ' ', 'help' => 'Click to load this menu.', )); } else { $inputs['menu'] = navigate_menu_output($wid); } $output = theme('navigate_menu_widget', $inputs, $wid); return $output; } /** * Theme search widget */ function theme_navigate_menu_widget($inputs, $wid) { $content['widget'] = ' '; $content['title'] = t('Menu'); return $content; } /** * Implementation of hook_perm() */ function navigate_menu_perm() { return array("navigate_menu use"); } /** * Implementation of hook_navigate_widget_process() */ function navigate_menu_navigate_widget_process($wid, $action) { switch ($action) { case 'load': echo navigate_menu_load(); break; } } /** * Output a rendered menu */ function navigate_menu_load() { $output = navigate_menu_output($_POST['wid']); return $output; } /** * Output the saved content */ function navigate_menu_output($wid) { $settings = navigate_widget_settings_get($wid); if ($_POST['mid']) { navigate_variable_set(array('value' => $_POST['mid'], 'name' => 'mid', 'wid' => $_POST['wid'])); $mid = $_POST['mid']; } elseif ($settings['mid']) { $mid = $settings['mid']; } if ($mid) { $output = ' '; } return $output; } /** * Renders a menu */ function navigate_menu_tree($pid = 1) { $menu = menu_get_menu(); $output = ''; if (isset($menu['visible'][$pid]) && $menu['visible'][$pid]['children']) { foreach ($menu['visible'][$pid]['children'] as $mid) { $type = isset($menu['visible'][$mid]['type']) ? $menu['visible'][$mid]['type'] : NULL; $children = isset($menu['visible'][$mid]['children']) ? $menu['visible'][$mid]['children'] : NULL; $output .= theme('menu_item', $mid, navigate_menu_theme_menu_tree($mid), count($children) == 0); } } return $output; } /** * Themes menu items, borrowed from the simplemenu module */ function navigate_menu_theme_menu_tree($pid = 1) { if ($tree = navigate_menu_tree($pid)) { return 'The Menu widget allows you add an expandable menu widget to your Navigate bar. After adding a Menu widget, you willl see a select box with a menu listing. Select the menu you would like to load and click the "Load" button to load it into the widget. Once a menu is loaded, there are no additional settings.
'); $help['title'] = 'Menu'; $help['access'] = user_access('navigate_menu use'); return $help; }