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 shortcut category.
|
37
|
$form['advanced_settings'] = array(
|
38
|
'#type' => 'fieldset',
|
39
|
'#title' => t('Advanced Settings'),
|
40
|
'#description' => '<div class="messages warning">WARNING: Do not change any of the advanced setting unless you know what you are doing!</div>',
|
41
|
);
|
42
|
|
43
|
$form['advanced_settings']['adminimal_admin_menu_slicknav'] = array(
|
44
|
'#type' => 'checkbox',
|
45
|
'#default_value' => variable_get('adminimal_admin_menu_slicknav', 'TRUE'),
|
46
|
'#title' => t('Enable Responsive Menu.'),
|
47
|
'#description' => t('<strong>Default value => Checked</strong>.
|
48
|
Enable this option if you want to have responsive menu and mobile device support.
|
49
|
While disabling this option could save you few kilobytes (around 3KB), i will completely disable the responsive menu functionality.'),
|
50
|
);
|
51
|
|
52
|
$form['advanced_settings']['adminimal_admin_menu_jquery'] = array(
|
53
|
'#type' => 'checkbox',
|
54
|
'#default_value' => variable_get('adminimal_admin_menu_jquery', 'TRUE'),
|
55
|
'#title' => t('Load the requred jQuery 1.7 library automagically.'),
|
56
|
'#description' => t('<strong>Default value => Checked</strong>. This will load the newer jQuery version 1.7 using
|
57
|
the no-conflict method so it wont interfere with any existing jQuery or other java-script libraries.
|
58
|
The only reason to uncheck this if you are already using a newer version of jQuery site-wide and its globally accessible by the "$" variable.
|
59
|
Unchekig this option could save you 33KB, but it may also break your javasctipt if not used correctly.'),
|
60
|
'#states' => array(
|
61
|
// Hide the settings when the cancel notify checkbox is disabled.
|
62
|
'visible' => array(
|
63
|
':input[name="adminimal_admin_menu_slicknav"]' => array('checked' => TRUE),
|
64
|
),
|
65
|
'unchecked' => array(
|
66
|
variable_get('adminimal_admin_menu_jquery', 'TRUE') => FALSE,
|
67
|
),
|
68
|
),
|
69
|
);
|
70
|
|
71
|
// Create the submit button.
|
72
|
$form['submit'] = array(
|
73
|
'#type' => 'submit',
|
74
|
'#value' => t('Save configuration'),
|
75
|
);
|
76
|
|
77
|
return $form;
|
78
|
|
79
|
}
|
80
|
|
81
|
/**
|
82
|
* Submit handler for views_sexy_throbber_settings().
|
83
|
*/
|
84
|
function adminimal_admin_menu_settings_submit($form, &$form_state) {
|
85
|
|
86
|
// Exclude unnecessary elements.
|
87
|
form_state_values_clean($form_state);
|
88
|
|
89
|
foreach ($form_state['values'] as $key => $value) {
|
90
|
if (is_array($value) && isset($form_state['values']['array_filter'])) {
|
91
|
$value = array_keys(array_filter($value));
|
92
|
}
|
93
|
variable_set($key, $value);
|
94
|
}
|
95
|
|
96
|
// Clear the admin menu cache.
|
97
|
admin_menu_flush_caches();
|
98
|
|
99
|
// Display a message to the user.
|
100
|
drupal_set_message(t('The configuration options have been saved.'));
|
101
|
}
|