You are here

function simplenews_field_views_data in Simplenews 3.x

Same name and namespace in other branches
  1. 8.2 simplenews.views.inc \simplenews_field_views_data()
  2. 8 simplenews.views.inc \simplenews_field_views_data()

Implements hook_field_views_data().

File

./simplenews.views.inc, line 13
Views interface for simplenews.

Code

function simplenews_field_views_data(FieldStorageConfigInterface $field_storage) {
  $data = views_field_default_views_data($field_storage);
  foreach ($data as $table_name => $table_data) {

    // Add the filter for newsletters.
    $data[$table_name][$field_storage
      ->getName() . '_target_id']['filter']['id'] = 'in_operator';
    $data[$table_name][$field_storage
      ->getName() . '_target_id']['filter']['options callback'] = 'simplenews_newsletter_list';
  }
  return $data;
}