interface FileValidatorInterface

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

Provides a file validator that supports a list of validations.

Hierarchy

Expanded class hierarchy of FileValidatorInterface

All classes that implement FileValidatorInterface

5 files declare their use of FileValidatorInterface
FileUploadHandler.php in core/modules/file/src/Upload/FileUploadHandler.php
FileUploadResource.php in core/modules/file/src/Plugin/rest/resource/FileUploadResource.php
FileValidationConstraintValidator.php in core/modules/file/src/Plugin/Validation/Constraint/FileValidationConstraintValidator.php
FileValidatorTestBase.php in core/modules/file/tests/src/Kernel/Validation/FileValidatorTestBase.php
TemporaryJsonapiFileFieldUploader.php in core/modules/jsonapi/src/Controller/TemporaryJsonapiFileFieldUploader.php

File

core/modules/file/src/Validation/FileValidatorInterface.php, line 11

Namespace

Drupal\file\Validation
View source
interface FileValidatorInterface {
    
    /**
     * Validates a File with a list of validators.
     *
     * @param \Drupal\file\FileInterface $file
     *   The file to validate.
     * @param array $validators
     *   An associative array of validators with:
     *   - key: the plugin ID of the file validation constraint.
     *   - value: an associative array of options to pass to the constraint.
     *
     * @return \Symfony\Component\Validator\ConstraintViolationListInterface
     *   The violations list.
     */
    public function validate(FileInterface $file, array $validators) : ConstraintViolationListInterface;

}

Members

Title Sort descending Modifiers Object type Summary
FileValidatorInterface::validate public function Validates a File with a list of validators.

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