You are here

function countries_views_data_alter in Countries 7.2

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

Implements hook_views_data_alter().

File

views/countries.views.inc, line 204
countries.views.inc

Code

function countries_views_data_alter(&$data) {
  $country_fields = array();
  foreach (field_info_fields() as $field_name => $field) {
    if ($field['module'] == 'countries') {
      $country_fields[$field_name] = $field;
    }
  }
  foreach ($data as $field_name => $field) {
    foreach (array_keys($country_fields) as $name) {

      // Check on field storage type prevents warnings on non-sql field storage.
      if (isset($field[$name]) && $country_fields[$name]['storage']['type'] == 'field_sql_storage') {
        $title = empty($data[$field_name][$name]['title']) ? '' : $data[$field_name][$name]['title'] . ' ';
        $data[$field_name][$name]['help'] = $title . t('If you need more fields add a country relationship.');
      }
    }
  }
}