class FileSanitizationEventSubscriber
Same name in other branches
- 10 core/modules/file/tests/modules/file_validator_test/src/EventSubscriber/FileSanitizationEventSubscriber.php \Drupal\file_validator_test\EventSubscriber\FileSanitizationEventSubscriber
Provides a file sanitization listener for file upload tests.
Hierarchy
- class \Drupal\file_validator_test\EventSubscriber\FileSanitizationEventSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of FileSanitizationEventSubscriber
1 string reference to 'FileSanitizationEventSubscriber'
- file_validator_test.services.yml in core/
modules/ file/ tests/ modules/ file_validator_test/ file_validator_test.services.yml - core/modules/file/tests/modules/file_validator_test/file_validator_test.services.yml
1 service uses FileSanitizationEventSubscriber
- file_validation_sanitization_subscriber in core/
modules/ file/ tests/ modules/ file_validator_test/ file_validator_test.services.yml - Drupal\file_validator_test\EventSubscriber\FileSanitizationEventSubscriber
File
-
core/
modules/ file/ tests/ modules/ file_validator_test/ src/ EventSubscriber/ FileSanitizationEventSubscriber.php, line 13
Namespace
Drupal\file_validator_test\EventSubscriberView source
class FileSanitizationEventSubscriber implements EventSubscriberInterface {
/**
* The allowed extensions.
*
* @var string[]
*/
protected array $allowedExtensions = [];
/**
* Handles the file sanitization event.
*/
public function onFileSanitization(FileUploadSanitizeNameEvent $event) {
$this->allowedExtensions = $event->getAllowedExtensions();
}
/**
* Gets the allowed extensions.
*
* @return string[]
* The allowed extensions.
*/
public function getAllowedExtensions() : array {
return $this->allowedExtensions;
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() : array {
return [
FileUploadSanitizeNameEvent::class => 'onFileSanitization',
];
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
FileSanitizationEventSubscriber::$allowedExtensions | protected | property | The allowed extensions. |
FileSanitizationEventSubscriber::getAllowedExtensions | public | function | Gets the allowed extensions. |
FileSanitizationEventSubscriber::getSubscribedEvents | public static | function | |
FileSanitizationEventSubscriber::onFileSanitization | public | function | Handles the file sanitization event. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.