| 6 ajax.inc | ctools_ajax_text_button($text, $dest, $alt, $class = '', $type = 'ctools-use-ajax') |
| 7 ajax.inc | ctools_ajax_text_button($text, $dest, $alt, $class = '', $type = 'use-ajax') |
Render text as a link. This will automatically apply an AJAX class to the link and add the appropriate javascript to make this happen.
Note: 'html' => true so be sure any text is vetted! Chances are these kinds of buttons will not use user input so this is a very minor concern.
$text: The text that will be displayed as the link.
$dest: The destination of the link.
$alt: The alt text of the link.
$class: Any class to apply to the link. @todo this should be a options array.
$type: A type to use, in case a different behavior should be attached. Defaults to ctools-use-ajax.
<?php
function ctools_ajax_text_button($text, $dest, $alt, $class = '', $type = 'use-ajax') {
drupal_add_library('system', 'drupal.ajax');
return l($text, $dest, array('html' => TRUE, 'attributes' => array('class' => array($type, $class), 'title' => $alt)));
}
?>