function EntityContextDefinition::getConstraintObjects

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Plugin/Context/EntityContextDefinition.php \Drupal\Core\Plugin\Context\EntityContextDefinition::getConstraintObjects()

File

core/lib/Drupal/Core/Plugin/Context/EntityContextDefinition.php, line 43

Class

EntityContextDefinition
Defines a class to provide entity context definitions.

Namespace

Drupal\Core\Plugin\Context

Code

protected function getConstraintObjects() {
  if (!$this->getConstraint('EntityType')) {
    $this->addConstraint('EntityType', [
      'type' => $this->getEntityTypeId(),
    ]);
  }
  return parent::getConstraintObjects();
}

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