Projet

Général

Profil

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

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

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
  $link_text = $link['title'];
27
  $attributes = array();
28

    
29
  if (!empty($variables['element']['#active'])) {
30
    // Add text to indicate active tab for non-visual users.
31
    $active = '<span class="element-invisible">' . t('(active tab)') . '</span>';
32

    
33
    // If the link does not contain HTML already, check_plain() it now.
34
    // After we set 'html'=TRUE the link will not be sanitized by l().
35
    if (empty($link['localized_options']['html'])) {
36
      $link['title'] = check_plain($link['title']);
37
    }
38
    $link['localized_options']['html'] = TRUE;
39
    $link_text = t('!local-task-title!active', array('!local-task-title' => $link['title'], '!active' => $active));
40

    
41
    $attributes['class'][] = 'active';
42
  }
43

    
44
  return '<li' . drupal_attributes($attributes) . '>' . l($link_text, $link['href'], $link['localized_options']) . "</li>\n";
45
}