You are here

function rate_views_data_alter in Rate 8

Same name and namespace in other branches
  1. 8.2 rate.views.inc \rate_views_data_alter()

Implements hook_views_data_alter().

File

./rate.views.inc, line 11
rate.views.inc

Code

function rate_views_data_alter(array &$data) {
  $entity_types = \Drupal::entityTypeManager()
    ->getDefinitions();
  foreach ($entity_types as $entity_type_id => $entity_type) {
    $data[$entity_type_id][$entity_type_id . '_rate_field'] = [
      'title' => t('Rate'),
      'field' => [
        'title' => t('Rate'),
        'help' => t('Displays a widget to vote this entity.'),
        'id' => 'rate_field',
      ],
      'filter' => [
        'title' => t('Rate'),
        'help' => t('Allow a filtering data per vote average.'),
        'id' => 'rate_filter',
      ],
      'sort' => [
        'title' => t('Rate'),
        'help' => t('Allow soring by vote average.'),
        'id' => 'rate_sort',
      ],
    ];
  }
}