- Patch #1217788 by droplet: drop IE7 support from Drupal 8.x.
[project/drupal.git] / core / themes / seven / template.php
CommitLineData
04d7eb4a 1<?php
04d7eb4a
DB
2
3/**
6cb598ec
DB
4 * Override or insert variables into the maintenance page template.
5 */
6function 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/**
96b9d512 16 * Override or insert variables into the html template.
04d7eb4a 17 */
96b9d512 18function seven_preprocess_html(&$vars) {
7818e2d4 19 // Add conditional CSS for IE8 and below.
2e7b2073 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));
6c0f8eba 21}
96b9d512
DB
22
23/**
24 * Override or insert variables into the page template.
25 */
04d7eb4a 26function seven_preprocess_page(&$vars) {
1a91990c
AB
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 );
04d7eb4a
DB
33}
34
35/**
36 * Display the list of available node types for node creation.
37 */
c05f2181
DB
38function seven_node_add_list($variables) {
39 $content = $variables['content'];
04d7eb4a
DB
40 $output = '';
41 if ($content) {
893a70b6 42 $output = '<ul class="admin-list">';
04d7eb4a
DB
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 }
413d51eb
DB
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 }
04d7eb4a
DB
54 return $output;
55}
56
57/**
0223bf1d 58 * Overrides theme_admin_block_content().
04d7eb4a 59 *
668630ab 60 * Use unordered list markup in both compact and extended mode.
04d7eb4a 61 */
c05f2181
DB
62function seven_admin_block_content($variables) {
63 $content = $variables['content'];
04d7eb4a
DB
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']);
0223bf1d 70 if (isset($item['description']) && !system_admin_compact_mode()) {
4f6dab56 71 $output .= '<div class="description">' . filter_xss_admin($item['description']) . '</div>';
04d7eb4a
DB
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 */
c05f2181
DB
85function seven_tablesort_indicator($variables) {
86 $style = $variables['style'];
04d7eb4a 87 $theme_path = drupal_get_path('theme', 'seven');
173b1392 88 if ($style == 'asc') {
1b4dfed4 89 return theme('image', array('uri' => $theme_path . '/images/arrow-asc.png', 'alt' => t('sort ascending'), 'width' => 13, 'height' => 13, 'title' => t('sort ascending')));
04d7eb4a
DB
90 }
91 else {
1b4dfed4 92 return theme('image', array('uri' => $theme_path . '/images/arrow-desc.png', 'alt' => t('sort descending'), 'width' => 13, 'height' => 13, 'title' => t('sort descending')));
04d7eb4a
DB
93 }
94}
3506918a
DB
95
96/**
89586bac
AB
97 * Implements hook_css_alter().
98 */
99function seven_css_alter(&$css) {
100 // Use Seven's vertical tabs style instead of the default one.
f434037c
NH
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';
89586bac 103 }
f434037c
NH
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';
7ef65310 106 }
366334cb 107 // Use Seven's jQuery UI theme style instead of the default one.
f434037c
NH
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';
366334cb 110 }
89586bac 111}