Projet

Général

Profil

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

root / drupal7 / sites / all / modules / adminimal_admin_menu / adminimal_menu_settings.inc @ 87dbc3bf

1
<?php
2

    
3
/**
4
 * @file
5
 * Menu builder functions for Administration menu.
6
 */
7

    
8
/**
9
 * Create the settings page form.
10
 */
11
function adminimal_admin_menu_settings($form, &$form_state) {
12

    
13
  // Create the shortcut category.
14
  $form['shortcuts'] = array(
15
    '#type' => 'fieldset',
16
    '#title' => t('Shortcuts options'),
17
  );
18

    
19
  // Create the select list.
20
  $form['shortcuts']['adminimal_admin_menu_render'] = array(
21
    '#type' => 'select',
22
    '#title' => t('Rendering method'),
23
    '#default_value' => variable_get('adminimal_admin_menu_render', 'collapsed'),
24
    '#options' => array(
25
      'hidden' => t('Hidden'),
26
      'inline' => t('Inline'),
27
      'collapsed' => t('Collapsed'),
28
      'newline' => t('Newline'),
29
      'dropdown' => t('Dropdown'),
30
      'exclusive' => t('Exclusive'),
31
    ),
32
    '#description' => t('Select how the shortcuts will be rendered. There are currently 6 options: <ol> <li>Hidden -> The shortcuts will not be rendered inside the admin menu</li> <li>Inline -> The shortcuts will be rendered on the same line with the root menu links</li> <li>Collapsed -> The sorctus links will be collapsed like a normal menu. <strong>(Default option)</strong></li> <li>Newline -> The shortcuts will be rendered on a new line. Below the root menu links.</li> <li>Dropdown -> The shortcuts will be rendered inside a dropdown using the select html tag.</li> <li>Exclusive -> Only the shortcuts will be rendered, and the normal menu will be hidden.</li></ol>'),
33
    '#required' => TRUE,
34
  );
35

    
36
  // Create the submit button.
37
  $form['submit'] = array(
38
    '#type' => 'submit',
39
    '#value' => t('Save configuration'),
40
  );
41

    
42
  return $form;
43

    
44
}
45

    
46
/**
47
 * Submit handler for views_sexy_throbber_settings().
48
 */
49
function adminimal_admin_menu_settings_submit($form, &$form_state) {
50

    
51
  // Exclude unnecessary elements.
52
  form_state_values_clean($form_state);
53

    
54
  foreach ($form_state['values'] as $key => $value) {
55
    if (is_array($value) && isset($form_state['values']['array_filter'])) {
56
      $value = array_keys(array_filter($value));
57
    }
58
    variable_set($key, $value);
59
  }
60

    
61
  // Clear the admin menu cache.
62
  admin_menu_flush_caches();
63

    
64
  // Display a message to the user.
65
  drupal_set_message(t('The configuration options have been saved.'));
66
}