You are here

class location_handler_field_location_country in Location 6.3

Same name and namespace in other branches
  1. 7.5 handlers/location_handler_field_location_country.inc \location_handler_field_location_country
  2. 7.3 handlers/location_handler_field_location_country.inc \location_handler_field_location_country
  3. 7.4 handlers/location_handler_field_location_country.inc \location_handler_field_location_country

@file Country field handler.

Hierarchy

Expanded class hierarchy of location_handler_field_location_country

1 string reference to 'location_handler_field_location_country'
location_views_data in ./location.views.inc
Implementation of hook_views_data().

File

handlers/location_handler_field_location_country.inc, line 8
Country field handler.

View source
class location_handler_field_location_country extends views_handler_field {
  function option_definition() {
    $options = parent::option_definition();
    $options['style'] = array(
      'default' => 'name',
    );
    return $options;
  }
  function options_form(&$form, &$form_state) {
    parent::options_form($form, $form_state);
    $form['style'] = array(
      '#title' => t('Display style'),
      '#type' => 'select',
      '#options' => array(
        'name' => t('Country name'),
        'code' => t('Country code'),
      ),
      '#default_value' => $this->options['style'],
    );
  }
  function render($values) {
    if ($this->options['style'] == 'name') {
      return check_plain(location_country_name($values->{$this->field_alias}));
    }
    else {
      return check_plain(strtoupper($values->{$this->field_alias}));
    }
  }

}

Members