You are here

public function Entity::getContextDefinition in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/argument_validator/Entity.php \Drupal\views\Plugin\views\argument_validator\Entity::getContextDefinition()

Returns a context definition for this argument.

Return value

\Drupal\Core\Plugin\Context\ContextDefinitionInterface|null A context definition that represents the argument or NULL if that is not possible.

Overrides ArgumentValidatorPluginBase::getContextDefinition

File

core/modules/views/src/Plugin/views/argument_validator/Entity.php, line 255

Class

Entity
Defines an argument validator plugin for each entity type.

Namespace

Drupal\views\Plugin\views\argument_validator

Code

public function getContextDefinition() {
  return EntityContextDefinition::fromEntityTypeId($this->definition['entity_type'])
    ->setLabel($this->argument
    ->adminLabel())
    ->setRequired(FALSE);
}