function Constraint::__construct

Same name in this branch
  1. 11.x core/lib/Drupal/Component/Version/Constraint.php \Drupal\Component\Version\Constraint::__construct()
Same name in other branches
  1. 9 core/lib/Drupal/Component/Version/Constraint.php \Drupal\Component\Version\Constraint::__construct()
  2. 8.9.x core/lib/Drupal/Component/Version/Constraint.php \Drupal\Component\Version\Constraint::__construct()
  3. 10 core/lib/Drupal/Core/Validation/Attribute/Constraint.php \Drupal\Core\Validation\Attribute\Constraint::__construct()
  4. 10 core/lib/Drupal/Component/Version/Constraint.php \Drupal\Component\Version\Constraint::__construct()

Constructs a Constraint attribute.

Parameters

string $id: The constraint plugin ID.

\Drupal\Core\StringTranslation\TranslatableMarkup|null $label: (optional) The human-readable name of the constraint plugin.

string|string[]|false $type: (optional) DataType plugin IDs for which this constraint applies. Valid values are any types registered by the typed data API, or an array of multiple type names. For supporting all types, FALSE may be specified. The key defaults to an empty array, which indicates no types are supported.

class-string|null $deriver: (optional) The deriver class.

Overrides Plugin::__construct

File

core/lib/Drupal/Core/Validation/Attribute/Constraint.php, line 40

Class

Constraint
Defines a Constraint attribute object.

Namespace

Drupal\Core\Validation\Attribute

Code

public function __construct(string $id, ?TranslatableMarkup $label = NULL, string|array|false $type = [], ?string $deriver = NULL) {
}

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