/[drupal]/contributions/modules/activemenu/README.txt
ViewVC logotype

Contents of /contributions/modules/activemenu/README.txt

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


Revision 1.1 - (show annotations) (download)
Fri Mar 28 16:36:44 2008 UTC (19 months, 4 weeks ago) by nedjo
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-6--2
File MIME type: text/plain
Drupal 6 update of activemenu module. Moving out of jstools.
1 Drupal activemenu.module README.txt
2 ==============================================================================
3
4 Makes standard Drupal menus into AJAX-based tree menus. Can also be used for
5 custom AJAX menus.
6
7
8 Requirements
9 ------------------------------------------------------------------------------
10 This module is written for Drupal 5.0+ and requires the jstools.module to be
11 enabled.
12
13 Developer Usage
14 -----------------------------------------------------------------------------
15 Activemenu.module by default handles the standard navigation menu and all
16 menus generated as blocks by the Menu module.
17
18 To create your own activemenus:
19
20 1. Write a handler function in a module to accept a path argument (passed as
21 a POST variable, 'href') and return an array of sub-items. For an example,
22 see activemenu_js(). The sub-items are in the format based on that returned
23 by menu_get_item() and have three array keys: children (boolean), path
24 (the url of the item), and title (this will be rendered as the text of the
25 menu item link).
26
27 Example:
28
29 function examplemodule_js() {
30 if (isset($_POST['href'])) {
31 $items = array();
32 $path = $_POST['href'];
33 switch ($path) {
34 case 'examplemodule/parent1':
35 $items[] = array(
36 'path' => 'examplemodule/parent1/child1',
37 'title' => t('First child option'),
38 'children' => TRUE
39 );
40 $items[] = array(
41 'path' => 'examplemodule/parent1/child2',
42 'title' => t('Second child option'),
43 'children' => FALSE
44 );
45 break;
46 case 'examplemodule/parent1/child1':
47 $items[] = array(
48 'path' => 'examplemodule/parent1/child1/grandchild1',
49 'title' => t('First grandchild option'),
50 'children' => FALSE
51 );
52 break;
53 }
54 print drupal_to_js($items);
55 }
56 exit();
57 }
58
59 2. Make your handler accessible to the menu system.
60
61 Example:
62
63 /**
64 * Implementation of hook_menu().
65 */
66 function examplemodule_menu($may_cache) {
67 $items = array();
68 if () {
69 $items[] = array(
70 'path' => 'examplemodule/js',
71 'title' => t('examplemodule'),
72 'access' => user_access('access content'),
73 'type' => MENU_CALLBACK,
74 'callback' => 'examplemodule_js'
75 );
76 }
77 return $items;
78 }
79
80 3. Implement hook_activemenu().
81
82 This hook returns an array of page elements to attach the activemenu behaviour to.
83
84 Array keys are valid jQuery selectors, while values are the path to load data from.
85
86 For example:
87
88 function user_activemenu() {
89 $items = array();
90 $items['#examplemodule-activemenu'] = 'examplemodule/js';
91 return $items;
92 }

  ViewVC Help
Powered by ViewVC 1.1.2