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

Breadcrumb

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

function Constraint::__construct

Same name in this branch
  1. 11.1.x vendor/composer/semver/src/Constraint/Constraint.php \Composer\Semver\Constraint\Constraint::__construct()
  2. 11.1.x vendor/symfony/validator/Constraint.php \Symfony\Component\Validator\Constraint::__construct()
  3. 11.1.x 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) {
}
RSS feed
Powered by Drupal