Moved the |media twig filter from the CMS module to the System module
This commit is contained in:
parent
de747f98b3
commit
08f9cd8448
|
|
@ -1191,16 +1191,6 @@ class Controller
|
|||
return $_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts supplied file to a URL relative to the media library.
|
||||
* @param string $file Specifies the media-relative file
|
||||
* @return string
|
||||
*/
|
||||
public function mediaUrl($file = null)
|
||||
{
|
||||
return MediaLibrary::url($file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a routing parameter.
|
||||
* @param string $name Routing parameter name.
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ class Extension extends Twig_Extension
|
|||
return [
|
||||
new Twig_SimpleFilter('page', [$this, 'pageFilter'], ['is_safe' => ['html']]),
|
||||
new Twig_SimpleFilter('theme', [$this, 'themeFilter'], ['is_safe' => ['html']]),
|
||||
new Twig_SimpleFilter('media', [$this, 'mediaFilter'], ['is_safe' => ['html']]),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -176,16 +175,6 @@ class Extension extends Twig_Extension
|
|||
return $this->controller->themeUrl($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts supplied file to a URL relative to the media library.
|
||||
* @param string $file Specifies the media-relative file
|
||||
* @return string
|
||||
*/
|
||||
public function mediaFilter($file)
|
||||
{
|
||||
return $this->controller->mediaUrl($file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a layout block.
|
||||
* @param string $name Specifies the block name
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use Twig_TokenParser;
|
|||
use Twig_SimpleFilter;
|
||||
use Twig_SimpleFunction;
|
||||
use ApplicationException;
|
||||
use System\Classes\MediaLibary;
|
||||
use System\Classes\MarkupManager;
|
||||
|
||||
/**
|
||||
|
|
@ -56,6 +57,7 @@ class Extension extends Twig_Extension
|
|||
{
|
||||
$filters = [
|
||||
new Twig_SimpleFilter('app', [$this, 'appFilter'], ['is_safe' => ['html']]),
|
||||
new Twig_SimpleFilter('media', [$this, 'mediaFilter'], ['is_safe' => ['html']]),
|
||||
];
|
||||
|
||||
/*
|
||||
|
|
@ -92,4 +94,14 @@ class Extension extends Twig_Extension
|
|||
{
|
||||
return Url::to($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts supplied file to a URL relative to the media library.
|
||||
* @param string $file Specifies the media-relative file
|
||||
* @return string
|
||||
*/
|
||||
public function mediaFilter($file)
|
||||
{
|
||||
return MediaLibrary::url($file);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue