You are here

public function EntityTypeAlter::alter in EntityFieldQuery Views Backend 8

Implements hook_entity_type_alter().

File

src/Hooks/EntityTypeAlter.php, line 17
Contains \Drupal\efq_views\Hooks\EntityTypeAlter.

Class

EntityTypeAlter

Namespace

Drupal\efq_views\Hooks

Code

public function alter(array &$entity_types) {

  /** @var \Drupal\Core\Entity\EntityTypeInterface $entity_type */

  // Replace all used views data handlers with a custom one.
  // @todo Decide the right strategy here.
  foreach ($entity_types as $entity_type) {
    if ($entity_type
      ->hasHandlerClass('views_data')) {
      $entity_type
        ->setHandlerClass('views_data', EqViewsData::class);
    }
  }
}