You are here

public function ViewsBulkOperationsEventSubscriber::provideViewData in Views Bulk Operations (VBO) 8.2

Same name and namespace in other branches
  1. 8.3 src/EventSubscriber/ViewsBulkOperationsEventSubscriber.php \Drupal\views_bulk_operations\EventSubscriber\ViewsBulkOperationsEventSubscriber::provideViewData()
  2. 8 src/EventSubscriber/ViewsBulkOperationsEventSubscriber.php \Drupal\views_bulk_operations\EventSubscriber\ViewsBulkOperationsEventSubscriber::provideViewData()
  3. 4.0.x src/EventSubscriber/ViewsBulkOperationsEventSubscriber.php \Drupal\views_bulk_operations\EventSubscriber\ViewsBulkOperationsEventSubscriber::provideViewData()

Respond to view data request event.

The event to respond to.

File

src/EventSubscriber/ViewsBulkOperationsEventSubscriber.php, line 51

Class

ViewsBulkOperationsEventSubscriber
Defines module event subscriber class.

Namespace

Drupal\views_bulk_operations\EventSubscriber

Code

public function provideViewData(ViewsBulkOperationsEvent $event) {
  $view_data = $event
    ->getViewData();
  if (!empty($view_data['table']['entity type'])) {
    $event
      ->setEntityTypeIds([
      $view_data['table']['entity type'],
    ]);
    $event
      ->setEntityGetter([
      'callable' => [
        $this->viewData,
        'getEntityDefault',
      ],
    ]);
  }
}