class FileNameLengthConstraint

Same name and namespace in other branches
  1. 10 core/modules/file/src/Plugin/Validation/Constraint/FileNameLengthConstraint.php \Drupal\file\Plugin\Validation\Constraint\FileNameLengthConstraint
  2. 11.x core/modules/file/src/Plugin/Validation/Constraint/FileNameLengthConstraint.php \Drupal\file\Plugin\Validation\Constraint\FileNameLengthConstraint

File name length constraint.

Attributes

#[Constraint(id: 'FileNameLength', label: new TranslatableMarkup('File Name Length', [], [ 'context' => 'Validation', ]), type: 'file')]

Hierarchy

  • class \Drupal\file\Plugin\Validation\Constraint\FileNameLengthConstraint extends \Symfony\Component\Validator\Constraint

Expanded class hierarchy of FileNameLengthConstraint

File

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

Namespace

Drupal\file\Plugin\Validation\Constraint
View source
class FileNameLengthConstraint extends SymfonyConstraint {
  public function __construct(public int $maxLength = 240, 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(groups: $groups, payload: $payload);
  }

}

Members

Title Sort descending Modifiers Object type Summary
FileNameLengthConstraint::__construct public function

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