FileIsImageConstraint.php

Same filename and directory in other branches
  1. 10 core/modules/file/src/Plugin/Validation/Constraint/FileIsImageConstraint.php
  2. 11.x core/modules/file/src/Plugin/Validation/Constraint/FileIsImageConstraint.php

Namespace

Drupal\file\Plugin\Validation\Constraint

File

core/modules/file/src/Plugin/Validation/Constraint/FileIsImageConstraint.php

View source
<?php

declare (strict_types=1);
namespace Drupal\file\Plugin\Validation\Constraint;

use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Validation\Attribute\Constraint;
use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint as SymfonyConstraint;

/**
 * File is image constraint.
 */
class FileIsImageConstraint extends SymfonyConstraint {
  public function __construct(mixed $options = NULL, public string $message = 'The image file is invalid or the image type is not allowed. Allowed types: %types', ?array $groups = NULL, mixed $payload = NULL) {
    parent::__construct($options, $groups, $payload);
  }

}

Classes

Title Deprecated Summary
FileIsImageConstraint File is image constraint.

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