Révision e5461e73
Ajouté par Julien Enselme il y a environ 9 ans
drupal7/sites/all/themes/rubik/template.php | ||
---|---|---|
3 | 3 |
* Implements hook_preprocess_html(). |
4 | 4 |
*/ |
5 | 5 |
function rubik_preprocess_html(&$vars) { |
6 |
if (module_exists('views')) { |
|
7 |
drupal_add_css(drupal_get_path('module', 'views') . '/css/views-admin.seven.css', 'theme'); |
|
8 |
} |
|
9 | 6 |
if (theme_get_setting('rubik_inline_field_descriptions')) { |
10 | 7 |
$vars['classes_array'][] = 'rubik-inline-field-descriptions'; |
11 | 8 |
} |
9 |
|
|
10 |
// add in a specific stylesheet for overrides in IE7. (BLAH) |
|
11 |
drupal_add_css(drupal_get_path('theme', 'rubik') . '/ie.css', array( |
|
12 |
'browsers' => array( |
|
13 |
'!IE' => FALSE, |
|
14 |
), |
|
15 |
'weight' => 500, |
|
16 |
'group' => 5000, |
|
17 |
'every_page' => TRUE, |
|
18 |
)); |
|
19 |
|
|
12 | 20 |
} |
13 | 21 |
|
14 | 22 |
/** |
... | ... | |
52 | 60 |
'process functions' => array('template_process'), |
53 | 61 |
); |
54 | 62 |
|
55 |
// Form layout: default (2 column). |
|
56 |
$items['block_add_block_form'] = |
|
57 |
$items['block_admin_configure'] = |
|
58 |
$items['comment_form'] = |
|
59 |
$items['contact_admin_edit'] = |
|
60 |
$items['contact_mail_page'] = |
|
61 |
$items['contact_mail_user'] = |
|
62 |
$items['filter_admin_format_form'] = |
|
63 |
$items['forum_form'] = |
|
64 |
$items['locale_languages_edit_form'] = |
|
65 |
$items['menu_edit_menu'] = |
|
66 |
$items['menu_edit_item'] = |
|
67 |
$items['node_type_form'] = |
|
68 |
$items['path_admin_form'] = |
|
69 |
$items['system_settings_form'] = |
|
70 |
$items['system_themes_form'] = |
|
71 |
$items['system_modules'] = |
|
72 |
$items['system_actions_configure'] = |
|
73 |
$items['taxonomy_form_term'] = |
|
74 |
$items['taxonomy_form_vocabulary'] = |
|
75 |
$items['user_profile_form'] = |
|
76 |
$items['user_admin_access_add_form'] = array( |
|
77 |
'render element' => 'form', |
|
78 |
'path' => drupal_get_path('theme', 'rubik') .'/templates', |
|
79 |
'template' => 'form-default', |
|
80 |
'preprocess functions' => array( |
|
81 |
'rubik_preprocess_form_buttons', |
|
82 |
), |
|
83 |
); |
|
84 |
|
|
85 |
// These forms require additional massaging. |
|
86 |
$items['confirm_form'] = array( |
|
87 |
'render element' => 'form', |
|
88 |
'path' => drupal_get_path('theme', 'rubik') .'/templates', |
|
89 |
'template' => 'form-simple', |
|
90 |
'preprocess functions' => array( |
|
91 |
'rubik_preprocess_form_confirm' |
|
92 |
), |
|
93 |
); |
|
94 |
$items['node_form'] = array( |
|
95 |
'render element' => 'form', |
|
96 |
'path' => drupal_get_path('theme', 'rubik') .'/templates', |
|
97 |
'template' => 'form-default', |
|
98 |
'preprocess functions' => array( |
|
99 |
'rubik_preprocess_form_buttons', |
|
100 |
'rubik_preprocess_form_node', |
|
101 |
), |
|
102 |
); |
|
63 |
if (!theme_get_setting('rubik_disable_sidebar_in_form')) { |
|
64 |
// Form layout: default (2 column). |
|
65 |
$items['block_add_block_form'] = |
|
66 |
$items['block_admin_configure'] = |
|
67 |
$items['comment_form'] = |
|
68 |
$items['contact_admin_edit'] = |
|
69 |
$items['contact_mail_page'] = |
|
70 |
$items['contact_mail_user'] = |
|
71 |
$items['filter_admin_format_form'] = |
|
72 |
$items['forum_form'] = |
|
73 |
$items['locale_languages_edit_form'] = |
|
74 |
$items['menu_edit_menu'] = |
|
75 |
$items['menu_edit_item'] = |
|
76 |
$items['node_type_form'] = |
|
77 |
$items['path_admin_form'] = |
|
78 |
$items['system_settings_form'] = |
|
79 |
$items['system_themes_form'] = |
|
80 |
$items['system_modules'] = |
|
81 |
$items['system_actions_configure'] = |
|
82 |
$items['taxonomy_form_term'] = |
|
83 |
$items['taxonomy_form_vocabulary'] = |
|
84 |
$items['user_profile_form'] = |
|
85 |
$items['user_admin_access_add_form'] = array( |
|
86 |
'render element' => 'form', |
|
87 |
'path' => drupal_get_path('theme', 'rubik') .'/templates', |
|
88 |
'template' => 'form-default', |
|
89 |
'preprocess functions' => array( |
|
90 |
'rubik_preprocess_form_buttons', |
|
91 |
), |
|
92 |
); |
|
103 | 93 |
|
94 |
// These forms require additional massaging. |
|
95 |
$items['confirm_form'] = array( |
|
96 |
'render element' => 'form', |
|
97 |
'path' => drupal_get_path('theme', 'rubik') .'/templates', |
|
98 |
'template' => 'form-simple', |
|
99 |
'preprocess functions' => array( |
|
100 |
'rubik_preprocess_form_confirm' |
|
101 |
), |
|
102 |
); |
|
103 |
$items['node_form'] = array( |
|
104 |
'render element' => 'form', |
|
105 |
'path' => drupal_get_path('theme', 'rubik') .'/templates', |
|
106 |
'template' => 'form-default', |
|
107 |
'preprocess functions' => array( |
|
108 |
'rubik_preprocess_form_buttons', |
|
109 |
'rubik_preprocess_form_node', |
|
110 |
), |
|
111 |
); |
|
112 |
} |
|
104 | 113 |
return $items; |
105 | 114 |
} |
106 | 115 |
|
... | ... | |
131 | 140 |
|
132 | 141 |
// Overlay is enabled. |
133 | 142 |
$vars['overlay'] = (module_exists('overlay') && overlay_get_mode() === 'child'); |
143 |
|
|
144 |
// Disable sticky in the sidebar. Set option in JS |
|
145 |
$disable_sticky = theme_get_setting('rubik_disable_sticky_sidebar'); |
|
146 |
drupal_add_js(array('rubik' => array('disable_sticky' => $disable_sticky)), array('type' => 'setting')); |
|
147 |
|
|
134 | 148 |
} |
135 | 149 |
|
136 | 150 |
/** |
... | ... | |
170 | 184 |
*/ |
171 | 185 |
function rubik_preprocess_form_node(&$vars) { |
172 | 186 |
$vars['sidebar'] = isset($vars['sidebar']) ? $vars['sidebar'] : array(); |
187 |
$map = array(); |
|
188 |
// Support field_group if present. |
|
189 |
if (module_exists('field_group')) { |
|
190 |
$map += array( |
|
191 |
'group_sidebar' => 'sidebar', |
|
192 |
'group_footer' => 'footer', |
|
193 |
); |
|
194 |
} |
|
173 | 195 |
// Support nodeformcols if present. |
174 | 196 |
if (module_exists('nodeformcols')) { |
175 |
$map = array( |
|
197 |
$map += array(
|
|
176 | 198 |
'nodeformcols_region_right' => 'sidebar', |
177 | 199 |
'nodeformcols_region_footer' => 'footer', |
178 | 200 |
'nodeformcols_region_main' => NULL, |
179 | 201 |
); |
202 |
} |
|
203 |
if (isset($map)) { |
|
180 | 204 |
foreach ($map as $region => $target) { |
181 | 205 |
if (isset($vars['form'][$region])) { |
182 | 206 |
if (isset($vars['form'][$region]['#prefix'], $vars['form'][$region]['#suffix'])) { |
... | ... | |
209 | 233 |
$classes = array( |
210 | 234 |
t('Save') => 'yes', |
211 | 235 |
t('Submit') => 'yes', |
212 |
t('Add') => 'yes', |
|
213 |
t('Delete') => 'no', |
|
236 |
t('Yes') => 'yes', |
|
237 |
t('Add') => 'add', |
|
238 |
t('Delete') => 'remove', |
|
239 |
t('Remove') => 'remove', |
|
214 | 240 |
t('Cancel') => 'no', |
241 |
t('No') => 'no', |
|
215 | 242 |
); |
216 | 243 |
foreach ($classes as $search => $class) { |
217 | 244 |
if (strpos($vars['element']['#value'], $search) !== FALSE) { |
... | ... | |
347 | 374 |
$item = menu_get_item(); |
348 | 375 |
$end = end($vars['breadcrumb']); |
349 | 376 |
if ($end && strip_tags($end) !== $item['title']) { |
350 |
$vars['breadcrumb'][] = check_plain($item['title']); |
|
377 |
$vars['breadcrumb'][] = (isset($item['localized_options']['html']) && $item['localized_options']['html']) ? $item['title'] : check_plain($item['title']);
|
|
351 | 378 |
} |
352 | 379 |
} |
353 | 380 |
|
... | ... | |
528 | 555 |
return drupal_render($elements); |
529 | 556 |
} |
530 | 557 |
|
558 |
function rubik_form_field_ui_field_edit_form_alter(&$form, &$form_state) { |
|
559 |
$rubik_sidebar_field_ui = theme_get_setting('rubik_sidebar_field_ui', 'rubik'); |
|
560 |
$rubik_disable_sidebar_in_form = theme_get_setting('rubik_disable_sidebar_in_form', 'rubik'); |
|
561 |
if ($rubik_sidebar_field_ui == 1 && $rubik_disable_sidebar_in_form == 0) { |
|
562 |
$options = array( |
|
563 |
'default' => t('Default'), |
|
564 |
'rubik_sidebar_field' => t('Sidebar'), |
|
565 |
); |
|
566 |
$default = (isset($form_state['build_info']['args'][0]['rubik_edit_field_display'])) ? $form_state['build_info']['args'][0]['rubik_edit_field_display'] : 'default'; |
|
567 |
$form['instance']['rubik_edit_field_display'] = array( |
|
568 |
'#type' => 'radios', |
|
569 |
'#title' => t('Set field display location'), |
|
570 |
'#description' => t('Choose where this field should be displayed.'), |
|
571 |
'#default_value' => $default, |
|
572 |
'#options' => $options, |
|
573 |
); |
|
574 |
} |
|
575 |
} |
|
576 |
|
|
577 |
function rubik_form_node_form_alter(&$form, $form_state) { |
|
578 |
$rubik_sidebar_field_ui = theme_get_setting('rubik_sidebar_field_ui', 'rubik'); |
|
579 |
if ($rubik_sidebar_field_ui == TRUE) { |
|
580 |
if (isset($form_state['field']) && is_array($form_state['field'])) { |
|
581 |
foreach ($form_state['field'] AS $name => $field) { |
|
582 |
if (!isset($field[LANGUAGE_NONE]['instance'])) { |
|
583 |
continue; |
|
584 |
} |
|
585 |
if (isset($field[LANGUAGE_NONE]['instance']['rubik_edit_field_display'])) { |
|
586 |
$display = $field[LANGUAGE_NONE]['instance']['rubik_edit_field_display']; |
|
587 |
if ($display == 'rubik_sidebar_field') { |
|
588 |
$form[$name]['#attributes']['class'][] = 'rubik_sidebar_field'; |
|
589 |
} |
|
590 |
} |
|
591 |
} |
|
592 |
} |
|
593 |
} |
|
594 |
} |
|
595 |
|
|
531 | 596 |
/** |
532 | 597 |
* Helper function to submitted info theming functions. |
533 | 598 |
*/ |
Formats disponibles : Unified diff
Update Rubik 4.0-rc1 4.2