You are here

class views_handler_field_data_markup in Data 8

Same name and namespace in other branches
  1. 6 views/views_handler_field_data_markup.inc \views_handler_field_data_markup
  2. 7 views/views_handler_field_data_markup.inc \views_handler_field_data_markup

A handler to run a field through check_markup.

Hierarchy

Expanded class hierarchy of views_handler_field_data_markup

2 string references to 'views_handler_field_data_markup'
data_data_views_handlers_alter in ./data.api.php
Declare additional Views handlers to the views data configuration options.
data_data_views_handlers_alter in ./data.views.inc
Implements hook_data_views_handlers_alter().

File

views/views_handler_field_data_markup.inc, line 6

View source
class views_handler_field_data_markup extends views_handler_field {
  function construct() {
    parent::construct();
    $this->format = $this->definition['format'];
  }
  function options_form(&$form, &$form_state) {
    parent::options_form($form, $form_state);
    $options = array(
      'default' => t('<Default>'),
    );
    $result = db_query("SELECT format, name FROM {filter_formats}");
    while ($row = db_fetch_object($result)) {
      $options[$row->format] = $row->name;
    }
    $form['format'] = array(
      '#type' => 'select',
      '#options' => $options,
      '#title' => t('Format'),
      '#default_value' => isset($this->options['format']) ? $this->options['format'] : '',
      '#description' => t('Choose the filter format to use for this field.'),
    );
  }
  function render($values) {
    $value = $values->{$this->field_alias};
    if ($value) {
      $format = is_numeric($this->options['format']) ? $this->options['format'] : variable_get('filter_default_format', 1);
      return check_markup($value, $format, $langcode = '', FALSE);
    }
  }

}

Members