class FileExtensionConstraint

Same name in other branches
  1. 10 core/modules/file/src/Plugin/Validation/Constraint/FileExtensionConstraint.php \Drupal\file\Plugin\Validation\Constraint\FileExtensionConstraint

File extension constraint.

Hierarchy

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

Expanded class hierarchy of FileExtensionConstraint

File

core/modules/file/src/Plugin/Validation/Constraint/FileExtensionConstraint.php, line 14

Namespace

Drupal\file\Plugin\Validation\Constraint
View source
class FileExtensionConstraint extends SymfonyConstraint {
    
    /**
     * The error message.
     *
     * @var string
     */
    public string $message = 'Only files with the following extensions are allowed: %files-allowed.';
    
    /**
     * The allowed file extensions.
     *
     * @var string
     */
    public string $extensions;
    
    /**
     * {@inheritdoc}
     */
    public function getDefaultOption() : ?string {
        return 'extensions';
    }

}

Members

Title Sort descending Modifiers Object type Summary
FileExtensionConstraint::$extensions public property The allowed file extensions.
FileExtensionConstraint::$message public property The error message.
FileExtensionConstraint::getDefaultOption public function

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