/[drupal]/contributions/modules/dhtml_menu/dhtml_menu.module
ViewVC logotype

Contents of /contributions/modules/dhtml_menu/dhtml_menu.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.47 - (show annotations) (download) (as text)
Sun Oct 25 14:58:28 2009 UTC (4 weeks, 6 days ago) by arancaytar
Branch: MAIN
Branch point for: DRUPAL-6--4
Changes since 1.46: +5 -3 lines
File MIME type: text/x-php
#473356: Big string update, adding new help strings and an explanatory installation message too.
1 <?php
2 // $Id: dhtml_menu.module,v 1.46 2009/10/25 14:42:44 arancaytar Exp $
3
4
5 /**
6 * @file dhtml_menu.module
7 * Initialization and various hook implementations.
8 */
9
10 require_once 'dhtml_menu.theme.inc';
11
12 /**
13 * Implementation of hook_help().
14 */
15 function dhtml_menu_help($path) {
16 switch ($path) {
17 case 'admin/settings/dhtml_menu':
18 $text = '<p>' . t('DHTML Menu adds dynamic functionality to the menus of your site. Ordinarily, reaching the child elements below an item requires you to visit its page. With this module enabled, clicking on an item with child elements will expand it without leaving the page, saving you the time of waiting for the page to load.') . '</p>';
19 $text .= '<p>' . t('<strong>Note:</strong> Links that gain a dynamic Javascript effect naturally stop working as normal links. Since you will occasionally need to visit a page that has sub-items (like the <a href="@url">main administration page</a>), this module provides several different options for static and dynamic navigation to coexist.', array('@url' => url('admin'))) . '</p>';
20 return $text;
21 }
22 }
23
24 /**
25 * Implementation of hook_init().
26 * Adds CSS, Javascript and settings to the page.
27 */
28 function dhtml_menu_init() {
29 drupal_add_css(drupal_get_path('module', 'dhtml_menu') . '/dhtml_menu.css');
30 drupal_add_js(drupal_get_path('module', 'dhtml_menu') . '/dhtml_menu.js');
31 drupal_add_js(array('dhtmlMenu' => variable_get('dhtml_menu_settings')), 'setting');
32 }
33
34 /**
35 * Implementation of hook_menu().
36 * Adds a settings page.
37 */
38 function dhtml_menu_menu() {
39 $menu['admin/settings/dhtml_menu'] = array(
40 'title' => 'DHTML Menu',
41 'description' => 'Configure the behavior of DHTML Menu.',
42 'page callback' => 'drupal_get_form',
43 'page arguments' => array('dhtml_menu_settings'),
44 'access arguments' => array('administer site configuration'),
45 'file' => 'dhtml_menu.admin.inc',
46 );
47 return $menu;
48 }
49
50 /**
51 * Implementation of hook_theme_registry_alter().
52 * Replaces the theme functions for the menu_item functions, and stores the
53 * original functions in order to call them when this module is done with preprocessing.
54 */
55 function dhtml_menu_theme_registry_alter(&$theme_registry) {
56 global $theme;
57
58 // Back up the existing theme functions.
59 $themes = variable_get('dhtml_menu_theme', array());
60 $themes[$theme] = array(
61 'menu_item' => $theme_registry['menu_item']['function'],
62 'menu_item_link' => $theme_registry['menu_item_link']['function'],
63 );
64 variable_set('dhtml_menu_theme', $themes);
65
66 // Replace them with our own. These will "preprocess" and call the real functions.
67 $theme_registry['menu_item']['function'] = 'dhtml_menu_theme_menu_item';
68 $theme_registry['menu_item_link']['function'] = 'dhtml_menu_theme_menu_item_link';
69 }

  ViewVC Help
Powered by ViewVC 1.1.2