Projet

Général

Profil

Paste
Télécharger (2,14 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / variable / includes / menu.variable.inc @ 6ae446a4

1
<?php
2
/**
3
 * @file
4
 * Variable API module. Definition for Drupal core variables
5
 */
6

    
7
/**
8
 * Implements hook_variable_info().
9
 */
10
function menu_variable_info($options) {
11
  $variables['menu_main_links_source'] = array(
12
    'type' => 'select',
13
    'title' => t('Source for the Main links'),
14
    'options' => 'menu',
15
    'default' => 'main-menu',
16
    'element' => array('#empty_option' => t('No Main links')),
17
    'description' => t('Select what should be displayed as the Main links (typically at the top of the page).', array(), $options),
18
    'group' => 'menu_settings'
19
  );
20
  $variables['menu_secondary_links_source'] = array(
21
    'type' => 'select',
22
    'title' => t('Source for the Secondary links'),
23
    'options' => 'menu',  
24
    'default' => 'user-menu',
25
    'element' => array('#empty_option' => t('No Secondary links')),
26
    'description' => t('Select the source for the Secondary links.', array() , $options),
27
    'group' => 'menu_settings'
28
  );
29
  $variables['menu_parent_[node_type]'] = array(
30
    'type' => 'multiple',
31
    'title' => t('Menu parent'),
32
    'repeat' => array(
33
      'type' => 'select',
34
      'options' => 'menu',
35
    ),
36
    'group' => 'menu_settings',
37
    'description' => t('Select the menu parent', array(), $options),
38
  );
39
  $variables['menu_options_[node_type]'] = array(
40
    'type' => 'multiple',
41
    'title' => t('Menu options'),
42
    'repeat' => array(
43
      'type' => 'options',
44
      'options' => 'menu',
45
    ),
46
    'description' => t('Select the available menus',array() , $options),
47
    'group' => 'menu_settings',
48
  );
49
  return $variables;
50
}
51

    
52
/**
53
 * Implements hook_variable_group_info().
54
 */
55
function menu_variable_group_info() {
56
  $groups['menu_settings'] = array(
57
    'title' => t('Menu settings'),
58
    'access' => 'administer menu',
59
    'path' => 'admin/structure/menu/settings',
60
  );
61
  return $groups;
62
}
63

    
64
/**
65
 * Implements hook_variable_type_info()
66
 */
67
function menu_variable_type_info() {
68
  $type['menu'] = array(
69
    'title' => t('Menu'),
70
    'type' => 'select',
71
    'options callback' => 'menu_variable_menu_list',
72
  );
73
  return $type;
74
}
75

    
76
/**
77
 * Menu option list
78
 */
79
function menu_variable_menu_list($variable, $options) {
80
  return menu_get_menus();
81
}