function ExtensionExistsConstraint::__construct

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

Constructs an ExtensionExistsConstraint.

Parameters

string $type: The type of extension to look for. Can be 'module' or 'theme'.

string $moduleMessage: Error message if module is not installed.

string $themeMessage: Error message if theme is not installed.

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/Extension/Plugin/Validation/Constraint/ExtensionExistsConstraint.php, line 34

Class

ExtensionExistsConstraint
Checks that the value is the name of an installed extension.

Namespace

Drupal\Core\Extension\Plugin\Validation\Constraint

Code

public function __construct(public string $type, public string $moduleMessage = "Module '@name' is not installed.", public string $themeMessage = "Theme '@name' is not installed.", ?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.