function hook_field_views_data_views_data_alter

3.x views.api.php hook_field_views_data_views_data_alter(&$data, $field)

Alter the views data on a per field basis.

Field module's implementation of hook_views_data_alter() invokes this for each field in the module that defines the field type (as declared in the field array). It is not invoked in other modules.

Unlike hook_field_views_data_alter(), this operates on the whole of the views data. This allows a field module to add data that concerns its fields to other tables, which would not yet be defined at the point when hook_field_views_data() and hook_field_views_data_alter() are invoked. For example, entityreference adds reverse relationships on the tables for the entities which are referenced by entityreference fields.

(Note: this is weirdly named so as not to conflict with hook_field_views_data_alter().)

See also

hook_field_views_data()

hook_field_views_data_alter()

field_views_data_alter()

Related topics

3 functions implement hook_field_views_data_views_data_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

file_field_views_data_views_data_alter in modules/file.views.inc
Implements hook_field_views_data_views_data_alter().
image_field_views_data_views_data_alter in modules/image.views.inc
Implements hook_field_views_data_views_data_alter().
taxonomy_field_views_data_views_data_alter in modules/taxonomy.views.inc
Implements hook_field_views_data_views_data_alter().

File

./views.api.php, line 585
Describe hooks provided by the Views module.

Code

function hook_field_views_data_views_data_alter(&$data, $field) {
  $field_name = $field['field_name'];
  $data_key = 'field_data_' . $field_name;
  // Views data for this field is in $data[$data_key]
}