function ViewsEntityArgumentValidator::getDerivativeDefinitions

Same name in other branches
  1. 9 core/modules/views/src/Plugin/Derivative/ViewsEntityArgumentValidator.php \Drupal\views\Plugin\Derivative\ViewsEntityArgumentValidator::getDerivativeDefinitions()
  2. 10 core/modules/views/src/Plugin/Derivative/ViewsEntityArgumentValidator.php \Drupal\views\Plugin\Derivative\ViewsEntityArgumentValidator::getDerivativeDefinitions()
  3. 11.x core/modules/views/src/Plugin/Derivative/ViewsEntityArgumentValidator.php \Drupal\views\Plugin\Derivative\ViewsEntityArgumentValidator::getDerivativeDefinitions()

Overrides DeriverBase::getDerivativeDefinitions

File

core/modules/views/src/Plugin/Derivative/ViewsEntityArgumentValidator.php, line 80

Class

ViewsEntityArgumentValidator
Provides views argument validator plugin definitions for all entity types.

Namespace

Drupal\views\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
    $entity_types = $this->entityTypeManager
        ->getDefinitions();
    $this->derivatives = [];
    foreach ($entity_types as $entity_type_id => $entity_type) {
        $this->derivatives[$entity_type_id] = [
            'id' => 'entity:' . $entity_type_id,
            'provider' => 'views',
            'title' => $entity_type->getLabel(),
            'help' => $this->t('Validate @label', [
                '@label' => $entity_type->getLabel(),
            ]),
            'entity_type' => $entity_type_id,
            'class' => $base_plugin_definition['class'],
        ];
    }
    return $this->derivatives;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.