function PluginExistsConstraint::__construct

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

Constructs a PluginExistsConstraint object.

Parameters

\Drupal\Component\Plugin\PluginManagerInterface $pluginManager: The plugin manager.

string $manager: The ID of the plugin manager service.

string|null $interface: Optional name of the interface that the plugin must implement.

bool|null $allowFallback: Whether to consider fallback plugin IDs as valid.

string $unknownPluginMessage: The error message if a plugin does not exist.

string $invalidInterfaceMessage: The error message if a plugin does not implement the expected interface.

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/Plugin/Plugin/Validation/Constraint/PluginExistsConstraint.php, line 44

Class

PluginExistsConstraint
Checks if a plugin exists and optionally implements a particular interface.

Namespace

Drupal\Core\Plugin\Plugin\Validation\Constraint

Code

public function __construct(public readonly PluginManagerInterface $pluginManager, protected string $manager, public ?string $interface = NULL, public bool $allowFallback = FALSE, public string $unknownPluginMessage = "The '@plugin_id' plugin does not exist.", public string $invalidInterfaceMessage = "The '@plugin_id' plugin must implement or extend @interface.", ?array $groups = NULL, mixed $payload = NULL) {
  parent::__construct(NULL, $groups, $payload);
}

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