You are here

function addressfield_views_handler_field_country::get_value in Address Field 7

Get the value that's supposed to be rendered.

This api exists so that other modules can easy set the values of the field without having the need to change the render method as well.

Parameters

object $values: An object containing all retrieved values.

string $field: Optional name of the field where the value is stored.

Overrides views_handler_field::get_value

File

views/addressfield_views_handler_field_country.inc, line 25

Class

addressfield_views_handler_field_country
Defines a field handler that can display the country name instead of the two character country code for an address field country value.

Code

function get_value($values, $field = NULL) {
  $value = parent::get_value($values, $field);

  // If we have a value for the field, look for the country name in the
  // Address Field options list array if specified.
  if (!empty($value) && !empty($this->options['display_name'])) {
    $countries = _addressfield_country_options_list();
    if (!empty($countries[$value])) {
      $value = $countries[$value];
    }
  }
  return $value;
}