Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x

FileNameLengthConstraint.php

Namespace

Drupal\file\Plugin\Validation\Constraint

File

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

View source
<?php

namespace Drupal\file\Plugin\Validation\Constraint;

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

/**
 * File name length constraint.
 */
class FileNameLengthConstraint extends SymfonyConstraint {
    
    /**
     * The maximum file name length.
     *
     * @var int
     */
    public int $maxLength = 240;
    
    /**
     * The message when file name is empty.
     *
     * @var string
     */
    public string $messageEmpty = "The file's name is empty. Enter a name for the file.";
    
    /**
     * The message when file name is too long.
     *
     * @var string
     */
    public string $messageTooLong = "The file's name exceeds the %maxLength characters limit. Rename the file and try again.";

}

Classes

Title Deprecated Summary
FileNameLengthConstraint File name length constraint.

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal