You are here

function countries_field_views_data in Countries 8

Same name and namespace in other branches
  1. 7.2 views/countries.views.inc \countries_field_views_data()

Implements hook_field_views_data().

See also

field_views_field_default_views_data()

File

views/countries.views.inc, line 229
countries.views.inc

Code

function countries_field_views_data($field) {
  $data = field_views_field_default_views_data($field);
  foreach ($data as $table_name => $table_data) {

    // Add the relationship only on the iso2 field.
    $data[$table_name][$field['field_name'] . '_iso2']['relationship'] = array(
      'handler' => 'views_handler_relationship',
      'base' => 'countries_country',
      'base field' => 'iso2',
      'label' => t('country from !field_name', array(
        '!field_name' => $field['field_name'],
      )),
      'help' => t('Provides access to all of the country properties.'),
      'countries' => array(
        'field' => $field['field_name'],
      ),
    );
  }
  return $data;
}