function EntityContextDefinition::__construct

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Plugin/Context/EntityContextDefinition.php \Drupal\Core\Plugin\Context\EntityContextDefinition::__construct()
  2. 10 core/lib/Drupal/Core/Plugin/Context/EntityContextDefinition.php \Drupal\Core\Plugin\Context\EntityContextDefinition::__construct()
  3. 11.x core/lib/Drupal/Core/Plugin/Context/EntityContextDefinition.php \Drupal\Core\Plugin\Context\EntityContextDefinition::__construct()

Overrides ContextDefinition::__construct

File

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

Class

EntityContextDefinition
Defines a class to provide entity context definitions.

Namespace

Drupal\Core\Plugin\Context

Code

public function __construct($data_type = 'any', $label = NULL, $required = TRUE, $multiple = FALSE, $description = NULL, $default_value = NULL) {
    // Prefix the data type with 'entity:' so that this class can be constructed
    // like so: new EntityContextDefinition('node')
    if (strpos($data_type, 'entity:') !== 0) {
        $data_type = "entity:{$data_type}";
    }
    parent::__construct($data_type, $label, $required, $multiple, $description, $default_value);
}

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