function FileNameLengthConstraint::__construct

Attributes

#[HasNamedArguments]

File

core/modules/file/src/Plugin/Validation/Constraint/FileNameLengthConstraint.php, line 27

Class

FileNameLengthConstraint
File name length constraint.

Namespace

Drupal\file\Plugin\Validation\Constraint

Code

public function __construct(mixed $options = NULL, ?int $maxLength = NULL, public string $messageEmpty = "The file's name is empty. Enter a name for the file.", public string $messageTooLong = "The file's name exceeds the %maxLength characters limit. Rename the file and try again.", ?array $groups = NULL, mixed $payload = NULL) {
  parent::__construct($options, $groups, $payload);
  $this->maxLength = $maxLength ?? $this->maxLength;
}

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