Révision 388c412d
Ajouté par Assos Assos il y a environ 7 ans
drupal7/sites/all/themes/bootstrap/templates/system/html.vars.php | ||
---|---|---|
18 | 18 |
// @see https://www.drupal.org/node/1077566 |
19 | 19 |
// @see https://www.drupal.org/node/1164926 |
20 | 20 |
|
21 |
// HTML element attributes. |
|
21 |
// Create a dedicated attributes array for the HTML element. |
|
22 |
// By default, core does not provide a way to target the HTML element. |
|
23 |
// The only arrays currently available technically belong to the BODY element. |
|
22 | 24 |
$variables['html_attributes_array'] = array( |
23 | 25 |
'lang' => $variables['language']->language, |
24 | 26 |
'dir' => $variables['language']->dir, |
... | ... | |
36 | 38 |
$variables['rdf_namespaces'] = drupal_attributes($rdf); |
37 | 39 |
} |
38 | 40 |
|
39 |
// BODY element attributes. |
|
40 |
$variables['body_attributes_array'] = array( |
|
41 |
'class' => &$variables['classes_array'], |
|
42 |
); |
|
43 |
$variables['body_attributes_array'] += $variables['attributes_array']; |
|
41 |
// Create a dedicated attributes array for the BODY element. |
|
42 |
if (!isset($variables['body_attributes_array'])) { |
|
43 |
$variables['body_attributes_array'] = array(); |
|
44 |
} |
|
45 |
|
|
46 |
// Ensure there is at least a class array. |
|
47 |
if (!isset($variables['body_attributes_array']['class'])) { |
|
48 |
$variables['body_attributes_array']['class'] = array(); |
|
49 |
} |
|
44 | 50 |
|
45 | 51 |
// Navbar position. |
46 | 52 |
switch (bootstrap_setting('navbar_position')) { |
... | ... | |
63 | 69 |
* |
64 | 70 |
* See template for list of available variables. |
65 | 71 |
* |
72 |
* **WARNING**: It is not recommended that this function be copied to a |
|
73 |
* sub-theme. There is rarely any need to process the same variables twice. |
|
74 |
* |
|
75 |
* If you need to add something to the "html_attributes_array" or |
|
76 |
* "body_attributes_array" arrays, you should do so in a hook_preprocess_html() |
|
77 |
* function since process functions will always run after all preprocess |
|
78 |
* functions have been executed. |
|
79 |
* |
|
80 |
* If there is a need to implement a hook_process_html() function in your |
|
81 |
* sub-theme (to process your own custom variables), ensure that it doesn't |
|
82 |
* add this base theme's logic and risk introducing breakage and performance |
|
83 |
* issues. |
|
84 |
* |
|
66 | 85 |
* @see html.tpl.php |
67 | 86 |
* |
68 | 87 |
* @ingroup theme_process |
69 | 88 |
*/ |
70 | 89 |
function bootstrap_process_html(&$variables) { |
90 |
// Merge in (not reference!) core's ambiguous and separate "attribute" and |
|
91 |
// "class" arrays. These arrays are meant for the BODY element, but it must |
|
92 |
// be done at the process level in case sub-themes wish to add classes to |
|
93 |
// core's non-standard arrays (which are for the BODY element only). |
|
94 |
// @see https://www.drupal.org/node/2868426 |
|
95 |
$variables['body_attributes_array'] = drupal_array_merge_deep($variables['body_attributes_array'], $variables['attributes_array']); |
|
96 |
|
|
97 |
// Use this project's class helper (to eliminate any duplicate classes). |
|
98 |
_bootstrap_add_class($variables['classes_array'], $variables, 'body_attributes_array'); |
|
99 |
|
|
100 |
// Finally, convert the arrays into proper attribute strings. |
|
71 | 101 |
$variables['html_attributes'] = drupal_attributes($variables['html_attributes_array']); |
72 | 102 |
$variables['body_attributes'] = drupal_attributes($variables['body_attributes_array']); |
73 | 103 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules