You are here

public function ViewsBulkOperationsEventSubscriber::provideViewData in Search API 8

Responds to view data request events.

The event to respond to.

File

src/Contrib/ViewsBulkOperationsEventSubscriber.php, line 36

Class

ViewsBulkOperationsEventSubscriber
Provides an event subscriber that interfaces with Views Bulk Operations.

Namespace

Drupal\search_api\Contrib

Code

public function provideViewData(ViewsBulkOperationsEvent $event) {
  $base_table = $event
    ->getView()->storage
    ->get('base_table');
  $index = SearchApiQuery::getIndexFromTable($base_table);
  if ($index) {
    $event
      ->setEntityTypeIds($index
      ->getEntityTypes());
    $event
      ->setEntityGetter([
      'callable' => [
        SearchApiQuery::class,
        'getEntityFromRow',
      ],
    ]);
  }
}