Révision fa691419
Ajouté par Assos Assos il y a presque 9 ans
drupal7/sites/all/modules/adminimal_admin_menu/adminimal_admin_menu.module | ||
---|---|---|
31 | 31 |
return; |
32 | 32 |
} |
33 | 33 |
$path = drupal_get_path('module', 'adminimal_admin_menu'); |
34 |
$load_slicknav = variable_get('adminimal_admin_menu_slicknav', TRUE ); |
|
35 |
$load_jQuery = variable_get('adminimal_admin_menu_jquery', TRUE ); |
|
34 | 36 |
|
35 | 37 |
// Attach the CSS and JavaScript assets. |
36 | 38 |
drupal_add_css($path . '/adminimal_admin_menu.css'); |
37 |
drupal_add_js($path . '/adminimal_admin_menu.js', 'file'); |
|
39 |
|
|
40 |
// Support for the Environment Indicator module. |
|
41 |
if (module_exists('environment_indicator')) { |
|
42 |
$environment_info = environment_indicator_get_active(); |
|
43 |
drupal_add_css(' |
|
44 |
div.slicknav_menu a.slicknav_btn:after { |
|
45 |
content: "' . $environment_info['name']. '"; |
|
46 |
margin-left: 1em; |
|
47 |
color: ' . $environment_info['text_color'] . '; |
|
48 |
font-size: 12px; |
|
49 |
background-color: ' . $environment_info['color'] . '; |
|
50 |
padding: 2px 5px; |
|
51 |
} |
|
52 |
#admin-menu-wrapper {background: #222 !important;} |
|
53 |
', |
|
54 |
array( |
|
55 |
'group' => CSS_DEFAULT, |
|
56 |
'type' => 'inline', |
|
57 |
'preprocess' => FALSE, |
|
58 |
'weight' => '100', |
|
59 |
)); |
|
60 |
} |
|
61 |
|
|
62 |
// Check if both slicknav and custom jQuery must be loaded. |
|
63 |
if ($load_slicknav and $load_jQuery) { |
|
64 |
drupal_add_js($path . '/js/jquery.min.js', array( 'type' => 'file', 'scope' => 'header', 'weight' => 888 )); |
|
65 |
drupal_add_js($path . '/js/slicknav/jquery-no-conflict.slicknav.js', array( 'type' => 'file', 'scope' => 'header', 'weight' => 888 )); |
|
66 |
drupal_add_css($path . '/js/slicknav/slicknav.css'); |
|
67 |
} |
|
68 |
elseif ($load_slicknav and !$load_jQuery) { |
|
69 |
drupal_add_js($path . '/js/slicknav/jquery.slicknav.js', array( 'type' => 'file', 'scope' => 'header', 'weight' => 888 )); |
|
70 |
drupal_add_css($path . '/js/slicknav/slicknav.css'); |
|
71 |
} |
|
72 |
|
|
73 |
drupal_add_js($path . '/js/adminimal_admin_menu.js', array( 'type' => 'file', 'scope' => 'header', 'weight' => 888 )); |
|
38 | 74 |
|
39 | 75 |
if (!isset($page['page_bottom']['admin_menu'])) { |
40 | 76 |
return; |
... | ... | |
63 | 99 |
'data' => array('admin_menu' => array('toolbar' => $settings)), |
64 | 100 |
'type' => 'setting', |
65 | 101 |
); |
102 |
|
|
66 | 103 |
} |
67 | 104 |
|
68 | 105 |
/** |
... | ... | |
114 | 151 |
unset($content['menu'][$key]); |
115 | 152 |
} |
116 | 153 |
} |
154 |
|
|
155 |
// Create the responsive menu. |
|
156 |
if (variable_get('adminimal_admin_menu_slicknav', 'TRUE')) { |
|
157 |
// Prepare the responsive menu and Join the Icon menu with the administration menu. |
|
158 |
$responsivemenu = array_merge($content['icon'], $content['menu']); |
|
159 |
|
|
160 |
// Give it ID to target it later with js and css. |
|
161 |
$responsivemenu['#wrapper_attributes']['id'] = 'admin-menu-menu-responsive'; |
|
162 |
|
|
163 |
// Move the icon menu to the top. |
|
164 |
$responsivemenu['icon']['#weight'] = '-100'; |
|
165 |
|
|
166 |
// Change the link title to Administration. |
|
167 |
$responsivemenu['admin/index']['#title'] = t('Administration'); |
|
168 |
|
|
169 |
// Bind the responsive menu the the content varable so it can be rendered. |
|
170 |
$content['responsive-menu'] = $responsivemenu; |
|
171 |
|
|
172 |
// Create the responsive shortucts. |
|
173 |
$content['responsive']['shortcuts'] = array( |
|
174 |
'#prefix' => '<div id="admin-menu-shortcuts-responsive">', |
|
175 |
'#suffix' => '</div>', |
|
176 |
'#pre_render' => array('shortcut_toolbar_pre_render'), |
|
177 |
); |
|
178 |
} |
|
117 | 179 |
} |
118 | 180 |
|
119 | 181 |
/** |
... | ... | |
126 | 188 |
// Add the "adminimal" class to the body for better css selection. |
127 | 189 |
$vars['classes_array'][] = 'adminimal-menu'; |
128 | 190 |
|
191 |
// Add frontend and backend classes to the body. |
|
192 |
if (path_is_admin(current_path())) { |
|
193 |
$vars['classes_array'][] = 'adminimal-backend'; |
|
194 |
} |
|
195 |
else { |
|
196 |
$vars['classes_array'][] = 'adminimal-frontend'; |
|
197 |
} |
|
198 |
|
|
129 | 199 |
// Add the shortcut render mode class. |
130 |
$vars['classes_array'][] = 'menu-render-'.variable_get('adminimal_admin_menu_render', 'collapsed'); |
|
200 |
$vars['classes_array'][] = 'menu-render-' . variable_get('adminimal_admin_menu_render', 'collapsed'); |
|
201 |
|
|
202 |
// Fix the viewport, correcting the mobile device zoom. |
|
203 |
/** @todo - Mybre remove this and let the theme manage the view pont. |
|
204 |
* But i was suprised that only few "responsive" drupal themes were fixing |
|
205 |
* the viewport. |
|
206 |
*/ |
|
207 |
$viewport = array( |
|
208 |
'#tag' => 'meta', |
|
209 |
'#attributes' => array( |
|
210 |
'name' => 'viewport', |
|
211 |
'content' => 'width=device-width, initial-scale=1, maximum-scale=1', |
|
212 |
), |
|
213 |
); |
|
214 |
drupal_add_html_head($viewport, 'viewport'); |
|
131 | 215 |
|
132 | 216 |
} |
133 | 217 |
|
Formats disponibles : Unified diff
Weekly update of contrib modules