function ContextDefinition::initializeEntityContextDefinition

Initializes $this->entityContextDefinition for backwards compatibility.

This method should be kept private so that it is only accessible to this class for backwards compatibility reasons. It will be removed in Drupal 9.

7 calls to ContextDefinition::initializeEntityContextDefinition()
ContextDefinition::addConstraint in core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php
Adds a validation constraint.
ContextDefinition::getConstraint in core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php
Gets a validation constraint.
ContextDefinition::getConstraintObjects in core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php
Extracts an array of constraints for a context definition object.
ContextDefinition::getConstraints in core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php
Gets an array of validation constraints.
ContextDefinition::isSatisfiedBy in core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php
Determines if this definition is satisfied by a context object.

... See full list

File

core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php, line 440

Class

ContextDefinition
Defines a class for context definitions.

Namespace

Drupal\Core\Plugin\Context

Code

private function initializeEntityContextDefinition() {
    if (!$this instanceof EntityContextDefinition && strpos($this->getDataType(), 'entity:') === 0 && !$this->entityContextDefinition) {
        $this->entityContextDefinition = EntityContextDefinition::create()->setDataType($this->getDataType())
            ->setLabel($this->getLabel())
            ->setRequired($this->isRequired())
            ->setMultiple($this->isMultiple())
            ->setDescription($this->getDescription())
            ->setConstraints($this->constraints)
            ->setDefaultValue($this->getDefaultValue());
    }
}

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