TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
MimeTypeValidator Class Reference
Inheritance diagram for MimeTypeValidator:
AbstractValidator ValidatorInterface

Public Member Functions

 isValid ($resource)
 
- Public Member Functions inherited from AbstractValidator
 __construct (array $options=[])
 
 validate ($value)
 
 getOptions ()
 

Protected Member Functions

 validateOptions ()
 
- Protected Member Functions inherited from AbstractValidator
 isValid ($value)
 
 addError ($message, $code, array $arguments=[], $title= '')
 
 isEmpty ($value)
 
 translateErrorMessage ($translateKey, $extensionName, $arguments=[])
 

Protected Attributes

 $supportedOptions
 
- Protected Attributes inherited from AbstractValidator
 $acceptsEmptyValues = true
 
 $supportedOptions = []
 
 $options = []
 
 $result
 

Detailed Description

Validator for mime types

Scope: frontend

Definition at line 29 of file MimeTypeValidator.php.

Member Function Documentation

isValid (   $resource)

The given $value is valid if it is an FileReference of the configured type (one of the image/* IANA media subtypes)

Note: a value of NULL or empty string ('') is considered valid

Parameters
FileReference | File$resourceThe resource that should be validated
Returns
void

Definition at line 48 of file MimeTypeValidator.php.

References AbstractValidator\addError(), AbstractValidator\translateErrorMessage(), and MimeTypeValidator\validateOptions().

validateOptions ( )
protected

Checks if this validator is correctly configured

Returns
void
Exceptions
InvalidValidationOptionsExceptionif the configured validation options are incorrect

Definition at line 84 of file MimeTypeValidator.php.

Referenced by MimeTypeValidator\isValid().

Member Data Documentation

$supportedOptions
protected
Initial value:
= [
'allowedMimeTypes' => [null, 'Allowed mime types (using */* IANA media types)', 'array', true]
]

Definition at line 34 of file MimeTypeValidator.php.