• Main Page
  • Related Pages
  • Modules
  • Classes
  • Files
  • File List
  • File Members

handlers/views_handler_field_url.inc

00001 <?php
00002 
00008 class views_handler_field_url extends views_handler_field {
00009   function option_definition() {
00010     $options = parent::option_definition();
00011 
00012     $options['display_as_link'] = array('default' => TRUE);
00013 
00014     return $options;
00015   }
00016 
00020   function options_form(&$form, &$form_state) {
00021     $form['display_as_link'] = array(
00022       '#title' => t('Display as link'),
00023       '#type' => 'checkbox',
00024       '#default_value' => !empty($this->options['display_as_link']),
00025     );
00026     parent::options_form($form, $form_state);
00027   }
00028 
00029   function render($values) {
00030     $value = $this->get_value($values);
00031     if (!empty($this->options['display_as_link'])) {
00032       return l($this->sanitize_value($value), $value, array('html' => TRUE));
00033     }
00034     else {
00035       return $this->sanitize_value($value, 'url');
00036     }
00037   }
00038 }

Generated on Sun Feb 26 2012 12:52:51 for Views by  doxygen 1.7.1