You are here

function countries_views_data in Countries 8

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

Implements hook_views_data().

File

views/countries.views.inc, line 11
countries.views.inc

Code

function countries_views_data() {
  $data = array();
  $data['countries_country']['table']['group'] = t('Countries');
  $data['countries_country']['table']['base'] = array(
    'field' => 'cid',
    'title' => t('Countries'),
    'help' => '',
  );
  $data['countries_country']['cid'] = array(
    'title' => t('Country ID'),
    'help' => t('The country ID of the country.'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  $data['countries_country']['iso2'] = array(
    'title' => t('ISO2'),
    'help' => t('The ISO2 country code of the country.'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_countries_country',
    ),
  );
  $data['countries_country']['iso2_list'] = array(
    'title' => t('ISO2 - list'),
    'help' => t('The ISO2 country code of the country.'),
    'real field' => 'iso2',
    'filter' => array(
      'handler' => 'views_handler_filter_countries_list',
      'property' => 'iso2',
    ),
  );
  $data['countries_country']['iso3'] = array(
    'title' => t('ISO3'),
    'help' => t('The ISO3 country code of the country.'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
      'property' => 'iso3',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_countries_country',
    ),
  );
  $data['countries_country']['iso3_list'] = array(
    'title' => t('ISO3 - list'),
    'help' => t('The ISO3 country code of the country.'),
    'real field' => 'iso2',
    'filter' => array(
      'handler' => 'views_handler_filter_countries_list',
      'property' => 'iso3',
    ),
  );
  $data['countries_country']['name'] = array(
    'title' => t('Name'),
    'help' => t('The name of the country.'),
    'field' => array(
      'handler' => 'views_handler_field_countries',
      'click sortable' => TRUE,
      'additional fields' => array(
        'iso2',
      ),
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_countries_country',
    ),
  );
  $data['countries_country']['name_list'] = array(
    'title' => t('Name - list'),
    'help' => t('The name of the country.'),
    'real field' => 'iso2',
    'filter' => array(
      'handler' => 'views_handler_filter_countries_list',
      'property' => 'name',
    ),
  );
  $data['countries_country']['official_name'] = array(
    'title' => t('Official name'),
    'help' => t('The official name of the country.'),
    'field' => array(
      'handler' => 'views_handler_field_countries',
      'additional fields' => array(
        'iso2',
      ),
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_countries_country',
    ),
  );
  $data['countries_country']['official_name_list'] = array(
    'title' => t('Official name - list'),
    'help' => t('The official name of the country.'),
    'real field' => 'iso2',
    'filter' => array(
      'handler' => 'views_handler_filter_countries_list',
      'property' => 'official_name',
    ),
  );
  $data['countries_country']['continent'] = array(
    'title' => t('Continent'),
    'help' => t('The continent of this country.'),
    'field' => array(
      'handler' => 'views_handler_field_countries_continent',
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_string',
    ),
  );
  $data['countries_country']['continent_list'] = array(
    'title' => t('Continent - list'),
    'help' => t('The continent of this country.'),
    'real field' => 'continent',
    'filter' => array(
      'handler' => 'views_handler_filter_in_operator',
      'property' => 'continent',
      'options callback' => 'countries_get_continents',
    ),
  );
  $data['countries_country']['enabled'] = array(
    'title' => t('Enabled'),
    'help' => t('Whether or not the country is enabled.'),
    'field' => array(
      'handler' => 'views_handler_field_boolean',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_boolean_operator',
      'label' => t('Enabled'),
      'type' => 'yes-no',
      // Use boolean_field = 1 instead of boolean_field <> 0 in WHERE statement.
      'use equal' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  return $data;
}