- Patch #1217788 by droplet: drop IE7 support from Drupal 8.x.
[project/drupal.git] / core / themes / seven / template.php
1 <?php
2
3 /**
4 * Override or insert variables into the maintenance page template.
5 */
6 function seven_preprocess_maintenance_page(&$vars) {
7 // While markup for normal pages is split into page.tpl.php and html.tpl.php,
8 // the markup for the maintenance page is all in the single
9 // maintenance-page.tpl.php template. So, to have what's done in
10 // seven_preprocess_html() also happen on the maintenance page, it has to be
11 // called here.
12 seven_preprocess_html($vars);
13 }
14
15 /**
16 * Override or insert variables into the html template.
17 */
18 function seven_preprocess_html(&$vars) {
19 // Add conditional CSS for IE8 and below.
20 drupal_add_css(path_to_theme() . '/ie.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE), 'weight' => 999, 'preprocess' => FALSE));
21 }
22
23 /**
24 * Override or insert variables into the page template.
25 */
26 function seven_preprocess_page(&$vars) {
27 $vars['primary_local_tasks'] = $vars['tabs'];
28 unset($vars['primary_local_tasks']['#secondary']);
29 $vars['secondary_local_tasks'] = array(
30 '#theme' => 'menu_local_tasks',
31 '#secondary' => $vars['tabs']['#secondary'],
32 );
33 }
34
35 /**
36 * Display the list of available node types for node creation.
37 */
38 function seven_node_add_list($variables) {
39 $content = $variables['content'];
40 $output = '';
41 if ($content) {
42 $output = '<ul class="admin-list">';
43 foreach ($content as $item) {
44 $output .= '<li class="clearfix">';
45 $output .= '<span class="label">' . l($item['title'], $item['href'], $item['localized_options']) . '</span>';
46 $output .= '<div class="description">' . filter_xss_admin($item['description']) . '</div>';
47 $output .= '</li>';
48 }
49 $output .= '</ul>';
50 }
51 else {
52 $output = '<p>' . t('You have not created any content types yet. Go to the <a href="@create-content">content type creation page</a> to add a new content type.', array('@create-content' => url('admin/structure/types/add'))) . '</p>';
53 }
54 return $output;
55 }
56
57 /**
58 * Overrides theme_admin_block_content().
59 *
60 * Use unordered list markup in both compact and extended mode.
61 */
62 function seven_admin_block_content($variables) {
63 $content = $variables['content'];
64 $output = '';
65 if (!empty($content)) {
66 $output = system_admin_compact_mode() ? '<ul class="admin-list compact">' : '<ul class="admin-list">';
67 foreach ($content as $item) {
68 $output .= '<li class="leaf">';
69 $output .= l($item['title'], $item['href'], $item['localized_options']);
70 if (isset($item['description']) && !system_admin_compact_mode()) {
71 $output .= '<div class="description">' . filter_xss_admin($item['description']) . '</div>';
72 }
73 $output .= '</li>';
74 }
75 $output .= '</ul>';
76 }
77 return $output;
78 }
79
80 /**
81 * Override of theme_tablesort_indicator().
82 *
83 * Use our own image versions, so they show up as black and not gray on gray.
84 */
85 function seven_tablesort_indicator($variables) {
86 $style = $variables['style'];
87 $theme_path = drupal_get_path('theme', 'seven');
88 if ($style == 'asc') {
89 return theme('image', array('uri' => $theme_path . '/images/arrow-asc.png', 'alt' => t('sort ascending'), 'width' => 13, 'height' => 13, 'title' => t('sort ascending')));
90 }
91 else {
92 return theme('image', array('uri' => $theme_path . '/images/arrow-desc.png', 'alt' => t('sort descending'), 'width' => 13, 'height' => 13, 'title' => t('sort descending')));
93 }
94 }
95
96 /**
97 * Implements hook_css_alter().
98 */
99 function seven_css_alter(&$css) {
100 // Use Seven's vertical tabs style instead of the default one.
101 if (isset($css['core/misc/vertical-tabs.css'])) {
102 $css['core/misc/vertical-tabs.css']['data'] = drupal_get_path('theme', 'seven') . '/vertical-tabs.css';
103 }
104 if (isset($css['core/misc/vertical-tabs-rtl.css'])) {
105 $css['core/misc/vertical-tabs-rtl.css']['data'] = drupal_get_path('theme', 'seven') . '/vertical-tabs-rtl.css';
106 }
107 // Use Seven's jQuery UI theme style instead of the default one.
108 if (isset($css['core/misc/ui/jquery.ui.theme.css'])) {
109 $css['core/misc/ui/jquery.ui.theme.css']['data'] = drupal_get_path('theme', 'seven') . '/jquery.ui.theme.css';
110 }
111 }