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 87dbc3bf Benjamin Luce
<?php
2
/**
3
 * @file
4 caf16a48 Assos Assos
 * Stub file for bootstrap_menu_local_task().
5 87dbc3bf Benjamin Luce
 */
6
7
/**
8 caf16a48 Assos Assos
 * 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 87dbc3bf Benjamin Luce
 */
24
function bootstrap_menu_local_task($variables) {
25
  $link = $variables['element']['#link'];
26 1f623f01 Assos Assos
27
  $options = isset($link['localized_options']) ? $link['localized_options'] : array();
28 7547bb19 Assos Assos
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 1f623f01 Assos Assos
  $href = $link['href'];
34 caf16a48 Assos Assos
  $attributes = array();
35 87dbc3bf Benjamin Luce
36 1f623f01 Assos Assos
  // Add text to indicate active tab for non-visual users.
37 87dbc3bf Benjamin Luce
  if (!empty($variables['element']['#active'])) {
38 1f623f01 Assos Assos
    $options['html'] = TRUE;
39 caf16a48 Assos Assos
    $attributes['class'][] = 'active';
40 1f623f01 Assos Assos
    $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 87dbc3bf Benjamin Luce
}