mirror of
https://github.com/getgrav/grav.git
synced 2026-03-06 12:31:53 +01:00
Add support for calling Media object as function to get medium by filename
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
1. [](#improved)
|
||||
* Better error handling in cache clear
|
||||
* Add support for calling Media object as function to get medium by filename
|
||||
1. [](#bugfix)
|
||||
* Added new parameter `remove` for `onBeforeCacheClear` event
|
||||
* YAML syntax fixes
|
||||
|
||||
@@ -31,6 +31,17 @@ abstract class AbstractMedia extends Getters
|
||||
return $this->offsetGet($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call object as function to get medium by filename.
|
||||
*
|
||||
* @param string $filename
|
||||
* @return mixed
|
||||
*/
|
||||
public function __invoke($filename)
|
||||
{
|
||||
return $this->offsetGet($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all media.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user