function ExtensionAvailableConstraint::__construct

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

Constructs an ExtensionAvailableConstraint object.

Parameters

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

string $moduleNotExistsMessage: The error message if the module does not exist.

string $themeNotExistsMessage: The error message if the theme does not exist.

string $profileNotExistsMessage: The error message if the profile does not exist.

string $couldNotLoadProfileToCheckExtension: The error message if the profile could not be loaded.

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/ExtensionAvailableConstraint.php, line 38

Class

ExtensionAvailableConstraint
Check if an extension (module, theme, or profile) is available.

Namespace

Drupal\Core\Extension\Plugin\Validation\Constraint

Code

public function __construct(public string $type, public string $moduleNotExistsMessage = "Module '@name' is not available.", public string $themeNotExistsMessage = "Theme '@name' is not available.", public string $profileNotExistsMessage = "Profile '@name' is not available.", public string $couldNotLoadProfileToCheckExtension = "Profile '@profile' could not be loaded to check if the extension '@extension' is available.", ?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.