Media Hooks

Media Module

The media module comes with the following hooks. You can hook into those using the usual listener logic.

Please view the hook section in the Core module.



The FileIsUpdating has one more method:

  • getFile(): Will return the file being updated

FileIsCreating Example

To keep the example simple we're going to use an inline listener using a closure instead of a full class.

Lets force a lowercase filename:

Event::listen(FileIsCreating::class, function (FileIsCreating $event) {
    $event->setAttributes(['filename' => strtolower($event->getAttribute('filename'))]);

Mobile Analytics