You are here

class currency_handler_field_currency in Currency 6

Same name and namespace in other branches
  1. 7 includes/views/handlers/currency_handler_field_currency.inc \currency_handler_field_currency

@file Views field handler.

Hierarchy

Expanded class hierarchy of currency_handler_field_currency

1 string reference to 'currency_handler_field_currency'
currency_views_data in views/currency.views.inc
Implementation of hook_views_data().

File

views/handlers/currency_handler_field_currency.inc, line 8
Views field handler.

View source
class currency_handler_field_currency extends views_handler_field {
  function render($values) {
    if ($this->options['display_code_only']) {
      return parent::render($values);
    }
    else {
      $currency_names = currency_api_get_list();
      $value = $currency_names[$values->{$this->field_alias}];
      return check_plain($value);
    }
  }
  function option_definition() {
    $options = parent::option_definition();
    $options['display_code_only'] = array(
      'default' => FALSE,
    );
    return $options;
  }
  function options_form(&$form, &$form_state) {
    parent::options_form($form, $form_state);
    $form['display_code_only'] = array(
      '#title' => t('Display as currency code only'),
      '#description' => t('Hides the descriptive currency name.'),
      '#type' => 'checkbox',
      '#default_value' => !empty($this->options['display_code_only']),
    );
  }

}

Members