You are here

function field_views_data in Views (for Drupal 7) 7.3

Same name and namespace in other branches
  1. 8.3 modules/field.views.inc \field_views_data()

Implements hook_views_data().

Field modules can implement hook_field_views_data() to override the default behavior for adding fields.

File

modules/field.views.inc, line 16
Provide Views data and handlers for field.module.

Code

function field_views_data() {
  $data = array();
  foreach (field_info_fields() as $field) {
    if ($field['storage']['type'] != 'field_sql_storage') {
      continue;
    }
    $module = $field['module'];
    $result = (array) module_invoke($module, 'field_views_data', $field);
    if (empty($result)) {
      $result = field_views_field_default_views_data($field);
    }
    drupal_alter('field_views_data', $result, $field, $module);
    if (is_array($result)) {
      $data = drupal_array_merge_deep($result, $data);
    }
  }
  return $data;
}