Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EntityContextDefinition.php

function 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, array $constraints = []) {
    // Prefix the data type with 'entity:' so that this class can be constructed
    // like so: new EntityContextDefinition('node')
    if (!str_starts_with($data_type, 'entity:')) {
        $data_type = "entity:{$data_type}";
    }
    parent::__construct($data_type, $label, $required, $multiple, $description, $default_value, $constraints);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal