cms/drupal/themes/seven/template.php
changeset 541 e756a8c72c3d
equal deleted inserted replaced
540:07239de796bb 541:e756a8c72c3d
       
     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   // Add conditional CSS for IE7 and below.
       
    22   drupal_add_css(path_to_theme() . '/ie7.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 7', '!IE' => FALSE), 'weight' => 999, 'preprocess' => FALSE));
       
    23   // Add conditional CSS for IE6.
       
    24   drupal_add_css(path_to_theme() . '/ie6.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 6', '!IE' => FALSE), 'weight' => 999, 'preprocess' => FALSE));
       
    25 }
       
    26 
       
    27 /**
       
    28  * Override or insert variables into the page template.
       
    29  */
       
    30 function seven_preprocess_page(&$vars) {
       
    31   $vars['primary_local_tasks'] = $vars['tabs'];
       
    32   unset($vars['primary_local_tasks']['#secondary']);
       
    33   $vars['secondary_local_tasks'] = array(
       
    34     '#theme' => 'menu_local_tasks',
       
    35     '#secondary' => $vars['tabs']['#secondary'],
       
    36   );
       
    37 }
       
    38 
       
    39 /**
       
    40  * Display the list of available node types for node creation.
       
    41  */
       
    42 function seven_node_add_list($variables) {
       
    43   $content = $variables['content'];
       
    44   $output = '';
       
    45   if ($content) {
       
    46     $output = '<ul class="admin-list">';
       
    47     foreach ($content as $item) {
       
    48       $output .= '<li class="clearfix">';
       
    49       $output .= '<span class="label">' . l($item['title'], $item['href'], $item['localized_options']) . '</span>';
       
    50       $output .= '<div class="description">' . filter_xss_admin($item['description']) . '</div>';
       
    51       $output .= '</li>';
       
    52     }
       
    53     $output .= '</ul>';
       
    54   }
       
    55   else {
       
    56     $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>';
       
    57   }
       
    58   return $output;
       
    59 }
       
    60 
       
    61 /**
       
    62  * Overrides theme_admin_block_content().
       
    63  *
       
    64  * Use unordered list markup in both compact and extended mode.
       
    65  */
       
    66 function seven_admin_block_content($variables) {
       
    67   $content = $variables['content'];
       
    68   $output = '';
       
    69   if (!empty($content)) {
       
    70     $output = system_admin_compact_mode() ? '<ul class="admin-list compact">' : '<ul class="admin-list">';
       
    71     foreach ($content as $item) {
       
    72       $output .= '<li class="leaf">';
       
    73       $output .= l($item['title'], $item['href'], $item['localized_options']);
       
    74       if (isset($item['description']) && !system_admin_compact_mode()) {
       
    75         $output .= '<div class="description">' . filter_xss_admin($item['description']) . '</div>';
       
    76       }
       
    77       $output .= '</li>';
       
    78     }
       
    79     $output .= '</ul>';
       
    80   }
       
    81   return $output;
       
    82 }
       
    83 
       
    84 /**
       
    85  * Override of theme_tablesort_indicator().
       
    86  *
       
    87  * Use our own image versions, so they show up as black and not gray on gray.
       
    88  */
       
    89 function seven_tablesort_indicator($variables) {
       
    90   $style = $variables['style'];
       
    91   $theme_path = drupal_get_path('theme', 'seven');
       
    92   if ($style == 'asc') {
       
    93     return theme('image', array('path' => $theme_path . '/images/arrow-asc.png', 'alt' => t('sort ascending'), 'width' => 13, 'height' => 13, 'title' => t('sort ascending')));
       
    94   }
       
    95   else {
       
    96     return theme('image', array('path' => $theme_path . '/images/arrow-desc.png', 'alt' => t('sort descending'), 'width' => 13, 'height' => 13, 'title' => t('sort descending')));
       
    97   }
       
    98 }
       
    99 
       
   100 /**
       
   101  * Implements hook_css_alter().
       
   102  */
       
   103 function seven_css_alter(&$css) {
       
   104   // Use Seven's vertical tabs style instead of the default one.
       
   105   if (isset($css['misc/vertical-tabs.css'])) {
       
   106     $css['misc/vertical-tabs.css']['data'] = drupal_get_path('theme', 'seven') . '/vertical-tabs.css';
       
   107     $css['misc/vertical-tabs.css']['type'] = 'file';
       
   108   }
       
   109   if (isset($css['misc/vertical-tabs-rtl.css'])) {
       
   110     $css['misc/vertical-tabs-rtl.css']['data'] = drupal_get_path('theme', 'seven') . '/vertical-tabs-rtl.css';
       
   111     $css['misc/vertical-tabs-rtl.css']['type'] = 'file';
       
   112   }
       
   113   // Use Seven's jQuery UI theme style instead of the default one.
       
   114   if (isset($css['misc/ui/jquery.ui.theme.css'])) {
       
   115     $css['misc/ui/jquery.ui.theme.css']['data'] = drupal_get_path('theme', 'seven') . '/jquery.ui.theme.css';
       
   116     $css['misc/ui/jquery.ui.theme.css']['type'] = 'file';
       
   117   }
       
   118 }