You are here

public function Entity::getContextDefinition in Drupal 8

Same name and namespace in other branches
  1. 9 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 266

Class

Entity
Defines a 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);
}