You are here

function name_field_views_data in Name Field 8

Implements hook_field_views_data().

Adds new fulltext name filter handler for every name field.

File

./name.views.inc, line 15
Views integration for name fields.

Code

function name_field_views_data(FieldStorageConfigInterface $field_storage) {
  $data = views_field_default_views_data($field_storage);
  $field_name = $field_storage
    ->getName();
  foreach ($data as $table_name => $table_data) {
    $data[$table_name][$field_name]['filter'] = [
      'field' => $field_name,
      'table' => $table_name,
      'field_name' => $field_name,
      'id' => 'name_fulltext',
      'allow_empty' => TRUE,
    ];
  }
  return $data;
}