ExtensionNameConstraint.php
Same filename and directory in other branches
Namespace
Drupal\Core\Extension\Plugin\Validation\ConstraintFile
-
core/
lib/ Drupal/ Core/ Extension/ Plugin/ Validation/ Constraint/ ExtensionNameConstraint.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Core\Extension\Plugin\Validation\Constraint;
use Drupal\Core\Extension\ExtensionDiscovery;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Validation\Attribute\Constraint;
use Drupal\Core\Validation\Plugin\Validation\Constraint\RegexConstraint;
use Symfony\Component\Validator\Attribute\HasNamedArguments;
/**
* Checks that the value is a valid extension name.
*/
class ExtensionNameConstraint extends RegexConstraint {
public function __construct(string|array|null $pattern, ?string $message = 'This value is not a valid extension name.', ?string $htmlPattern = NULL, ?bool $match = NULL, ?callable $normalizer = NULL, ?array $groups = NULL, mixed $payload = NULL, ?array $options = NULL) {
// Always use the regular expression that ExtensionDiscovery uses to find
// valid extensions.
$pattern = ExtensionDiscovery::PHP_FUNCTION_PATTERN;
parent::__construct($pattern, $message, $htmlPattern, $match, $normalizer, $groups, $payload, $options);
}
}
Classes
| Title | Deprecated | Summary |
|---|---|---|
| ExtensionNameConstraint | Checks that the value is a valid extension name. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.