Projet

Général

Profil

Révision 96a203dd

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

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/ctools/includes/ajax.inc
49 49
  return l($text, $dest, array('html' => TRUE, 'attributes' => array('class' => array($type, $class), 'title' => $alt)));
50 50
}
51 51

  
52
/**
53
 * Render an icon and related text as a link. This will automatically apply an AJAX class
54
 * to the link and add the appropriate javascript to make this happen.
55
 *
56
 * Note: 'html' => true so be sure any text is vetted! Chances are these kinds of buttons will
57
 * not use user input so this is a very minor concern.
58
 *
59
 * @param $text
60
 *   The text that will be displayed as the link.
61
 * @param $image
62
 *   The icon image to include in the link.
63
 * @param $dest
64
 *   The destination of the link.
65
 * @param $alt
66
 *   The title text of the link.
67
 * @param $class
68
 *   Any class to apply to the link. @todo this should be a options array.
69
 * @param $type
70
 *   A type to use, in case a different behavior should be attached. Defaults
71
 *   to ctools-use-ajax.
72
 */
73
function ctools_ajax_icon_text_button($text, $image, $dest, $alt, $class = '', $type = 'use-ajax') {
74
  drupal_add_library('system', 'drupal.ajax');
75
  $rendered_image = theme('image', array('path' => $image));
76
  $link_content = $rendered_image . "<span>" . $text . "</span>";
77
  return l($link_content, $dest, array('html' => TRUE, 'attributes' => array('class' => array($type, $class), 'title' => $alt)));
78
}
79

  
52 80
/**
53 81
 * Set a single property to a value, on all matched elements.
54 82
 *

Formats disponibles : Unified diff