function FileValidatorInterface::validate

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

Validates a File with a list of validators.

Parameters

\Drupal\file\FileInterface $file: The file to validate.

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 value

\Symfony\Component\Validator\ConstraintViolationListInterface The violations list.

File

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

Class

FileValidatorInterface
Provides a file validator that supports a list of validations.

Namespace

Drupal\file\Validation

Code

public function validate(FileInterface $file, array $validators) : ConstraintViolationListInterface;

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