class FileEncodingConstraint
Same name and namespace in other branches
- 11.x core/modules/file/src/Plugin/Validation/Constraint/FileEncodingConstraint.php \Drupal\file\Plugin\Validation\Constraint\FileEncodingConstraint
Defines an encoding constraint for files.
Attributes
#[Constraint(id: 'FileEncoding', label: new TranslatableMarkup('File encoding', [], [
'context' => 'Validation',
]))]
Hierarchy
- class \Drupal\file\Plugin\Validation\Constraint\FileEncodingConstraint extends \Symfony\Component\Validator\Constraint
Expanded class hierarchy of FileEncodingConstraint
File
-
core/
modules/ file/ src/ Plugin/ Validation/ Constraint/ FileEncodingConstraint.php, line 15
Namespace
Drupal\file\Plugin\Validation\ConstraintView source
class FileEncodingConstraint extends SymfonyConstraint {
/**
* The allowed file encodings.
*
* @var array
*/
public array $encodings;
public function __construct(mixed $options = NULL, ?array $encodings = NULL, public string $message = "The file is encoded with %detected. It must be encoded with %encoding", ?array $groups = NULL, mixed $payload = NULL) {
parent::__construct($options, $groups, $payload);
$this->encodings = $encodings ?? $this->encodings;
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary |
|---|---|---|---|
| FileEncodingConstraint::$encodings | public | property | The allowed file encodings. |
| FileEncodingConstraint::__construct | public | function | #[HasNamedArguments] |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.