function FileEventSubscriber::getSubscribedEvents

Same name and namespace in other branches
  1. 10 core/modules/file/src/EventSubscriber/FileEventSubscriber.php \Drupal\file\EventSubscriber\FileEventSubscriber::getSubscribedEvents()
  2. 11.x core/modules/file/src/EventSubscriber/FileEventSubscriber.php \Drupal\file\EventSubscriber\FileEventSubscriber::getSubscribedEvents()

File

core/modules/file/src/EventSubscriber/FileEventSubscriber.php, line 40

Class

FileEventSubscriber
Sanitizes uploaded filenames.

Namespace

Drupal\file\EventSubscriber

Code

public static function getSubscribedEvents() : array {
  return [
    FileUploadSanitizeNameEvent::class => [
      // Run before every other listener so that they can all rely on the
      // filename being valid UTF-8, and therefore safe to manipulate with
      // PCRE's /u modifier and the mb_* functions.
[
        'ensureValidUtf8Filename',
        PHP_INT_MAX,
      ],
      [
        'sanitizeFilename',
      ],
    ],
  ];
}

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