2 // $Id: views_handler_field_url.inc,v 1.1 2008/09/03 19:21:28 merlinofchaos Exp $
5 * Field handler to provide simple renderer that turns a URL into a clickable link.
7 * @ingroup views_field_handlers
9 class views_handler_field_url extends views_handler_field {
10 function option_definition() {
11 $options = parent::option_definition();
13 $options['display_as_link'] = array('default' => TRUE);
19 * Provide link to the page being visited.
21 function options_form(&$form, &$form_state) {
22 parent::options_form($form, $form_state);
23 $form['display_as_link'] = array(
24 '#title' => t('Display as link'),
25 '#type' => 'checkbox',
26 '#default_value' => !empty($this->options['display_as_link']),
30 function render($values) {
31 $value = $values->{$this->field_alias};
32 if (!empty($this->options['display_as_link'])) {
33 return l(check_plain($value), $value, array('html' => TRUE));