Projet

Général

Profil

Révision 1f623f01

Ajouté par Assos Assos il y a plus de 7 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/themes/bootstrap/templates/menu/menu-local-action.func.php
22 22
 */
23 23
function bootstrap_menu_local_action($variables) {
24 24
  $link = $variables['element']['#link'];
25

  
25
  $title = $link['title'];
26
  $icon = _bootstrap_iconize_text($title);
27
  $href = !empty($link['href']) ? $link['href'] : FALSE;
26 28
  $options = isset($link['localized_options']) ? $link['localized_options'] : array();
27 29

  
28
  // If the title is not HTML, sanitize it.
29
  if (empty($options['html'])) {
30
    $link['title'] = check_plain($link['title']);
31
  }
32

  
33
  $icon = _bootstrap_iconize_text($link['title']);
34

  
35 30
  // Format the action link.
36
  $output = '';
37
  if (isset($link['href'])) {
31
  if ($href) {
38 32
    // Turn link into a mini-button and colorize based on title.
39
    if ($class = _bootstrap_colorize_text($link['title'])) {
33
    if ($class = _bootstrap_colorize_text($title)) {
40 34
      if (!isset($options['attributes']['class'])) {
41 35
        $options['attributes']['class'] = array();
42 36
      }
......
53 47
    }
54 48
    // Force HTML so we can render any icon that may have been added.
55 49
    $options['html'] = !empty($options['html']) || !empty($icon) ? TRUE : FALSE;
56
    $output .= l($icon . $link['title'], $link['href'], $options);
57 50
  }
58
  else {
59
    $output .= $icon . $link['title'];
51

  
52
  // Filter the title if the "html" is set, otherwise l() will automatically
53
  // sanitize using check_plain(), so no need to call that here.
54
  if (!empty($options['html'])) {
55
    $title = _bootstrap_filter_xss($title);
60 56
  }
61 57

  
62
  return $output;
58
  return $href ? l($icon . $title, $href, $options) : $icon . $title;
63 59
}

Formats disponibles : Unified diff