[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/data/views/ -> views_handler_field_data_markup.inc (source)

   1  <?php
   2  
   3  /**
   4   * A handler to run a field through check_markup.
   5   */
   6  class views_handler_field_data_markup extends views_handler_field {
   7  
   8    function construct() {
   9      parent::construct();
  10      $this->format = $this->definition['format'];
  11    }
  12  
  13    function options_form(&$form, &$form_state) {
  14      parent::options_form($form, $form_state);
  15  
  16      $options = array('default' => t('<Default>'));
  17      $result = db_query("SELECT format, name FROM {filter_formats}");
  18      while ($row = db_fetch_object($result)) {
  19        $options[$row->format] = $row->name;
  20      }
  21      $form['format'] = array(
  22        '#type' => 'select',
  23        '#options' => $options,
  24        '#title' => t('Format'),
  25        '#default_value' => isset($this->options['format']) ? $this->options['format'] : '',
  26        '#description' => t('Choose the filter format to use for this field.'),
  27      );
  28    }
  29  
  30    function render($values) {
  31      $value = $values->{$this->field_alias};
  32      if ($value) {
  33        $format = is_numeric($this->options['format']) ? $this->options['format'] : variable_get('filter_default_format', 1);
  34        return check_markup($value, $format, FALSE);
  35      }
  36    }
  37  }


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7