function EntityBundleExistsConstraint::__construct

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/EntityBundleExistsConstraint.php \Drupal\Core\Validation\Plugin\Validation\Constraint\EntityBundleExistsConstraint::__construct()

Constructs an EntityBundleExistsConstraint.

Parameters

string $entityTypeId: The entity type ID which should have the given bundle. This can contain variable values (e.g., `%parent`) that will be replaced. @see \Drupal\Core\Config\Schema\TypeResolver::replaceVariable()

string $message: The error message.

array|null $groups: The groups that the constraint belongs to.

mixed|null $payload: Domain-specific data attached to a constraint.

File

core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/EntityBundleExistsConstraint.php, line 38

Class

EntityBundleExistsConstraint
Checks if a bundle exists on a certain content entity type.

Namespace

Drupal\Core\Validation\Plugin\Validation\Constraint

Code

public function __construct(public string $entityTypeId, public $message = "The '@bundle' bundle does not exist on the '@entity_type_id' entity type.", ?array $groups = NULL, mixed $payload = NULL) {
  parent::__construct(groups: $groups, payload: $payload);
}

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