Projet

Général

Profil

Paste
Télécharger (1,41 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / themes / bootstrap / templates / menu / menu-local-task.func.php @ 7547bb19

1
<?php
2
/**
3
 * @file
4
 * Stub file for bootstrap_menu_local_task().
5
 */
6

    
7
/**
8
 * Returns HTML for a single local task link.
9
 *
10
 * @param array $variables
11
 *   An associative array containing:
12
 *   - element: A render element containing:
13
 *     - #link: A menu link array with 'title', 'href', and 'localized_options'
14
 *       keys.
15
 *     - #active: A boolean indicating whether the local task is active.
16
 *
17
 * @return string
18
 *   The constructed HTML.
19
 *
20
 * @see theme_menu_local_task()
21
 *
22
 * @ingroup theme_functions
23
 */
24
function bootstrap_menu_local_task($variables) {
25
  $link = $variables['element']['#link'];
26

    
27
  $options = isset($link['localized_options']) ? $link['localized_options'] : array();
28

    
29
  // Filter the title if the "html" is not set, otherwise l() will automatically
30
  // sanitize using check_plain(), so no need to call that here.
31
  $title = empty($options['html']) ? filter_xss_admin($link['title']) : $link['title'];
32

    
33
  $href = $link['href'];
34
  $attributes = array();
35

    
36
  // Add text to indicate active tab for non-visual users.
37
  if (!empty($variables['element']['#active'])) {
38
    $options['html'] = TRUE;
39
    $attributes['class'][] = 'active';
40
    $title = t('!local-task-title!active', array(
41
      '!local-task-title' => $title,
42
      '!active' => '<span class="element-invisible">' . t('(active tab)') . '</span>',
43
    ));
44
  }
45

    
46
  return '<li' . drupal_attributes($attributes) . '>' . l($title, $href, $options) . "</li>\n";
47
}