You are here

public function ViewsEntityArgumentValidator::getDerivativeDefinitions in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/Derivative/ViewsEntityArgumentValidator.php \Drupal\views\Plugin\Derivative\ViewsEntityArgumentValidator::getDerivativeDefinitions()

Gets the definition of all derivatives of a base plugin.

Parameters

array $base_plugin_definition: The definition array of the base plugin.

Return value

array An array of full derivative definitions keyed on derivative id.

Overrides DeriverBase::getDerivativeDefinitions

See also

getDerivativeDefinition()

File

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

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;
}