|
|
@@ -61,13 +61,37 @@ class TwigExtension extends AbstractExtension |
|
|
|
new TwigFunction('sov_get_by_devalias', [$this, 'getByDevAlias']), |
|
|
|
new TwigFunction('sov_parameter', [$this, 'getParameter']), |
|
|
|
new TwigFunction('sov_homepage_route', [$this, 'getHomepageRoute']), |
|
|
|
new TwigFunction('lc_format_price', [$this, 'formatPrice']), |
|
|
|
new TwigFunction('die', [$this, 'die']), |
|
|
|
]; |
|
|
|
} |
|
|
|
|
|
|
|
public function die() |
|
|
|
{ |
|
|
|
die(); |
|
|
|
} |
|
|
|
|
|
|
|
public function getFilters() |
|
|
|
{ |
|
|
|
return []; |
|
|
|
return [ |
|
|
|
new TwigFilter('uc_first', [$this, 'ucFirst']), |
|
|
|
new TwigFilter('format_price', [$this, 'formatPrice']), |
|
|
|
|
|
|
|
]; |
|
|
|
} |
|
|
|
|
|
|
|
public function formatPrice($price, $unbreakableSpace = true) |
|
|
|
{ |
|
|
|
$price = number_format($price, 2, ',', ' '); |
|
|
|
$price .= $unbreakableSpace ? ' ' : ' '; |
|
|
|
$price .= '€'; |
|
|
|
|
|
|
|
return $price; |
|
|
|
} |
|
|
|
|
|
|
|
public function ucFirst($string) |
|
|
|
{ |
|
|
|
return ucfirst($string); |
|
|
|
} |
|
|
|
|
|
|
|
public function liip($path, $thumb = 'tile', $default = 'default.jpg') |
|
|
@@ -80,7 +104,7 @@ class TwigExtension extends AbstractExtension |
|
|
|
$fileManagerFolder = substr($this->getFileManagerFolder(), 1); |
|
|
|
|
|
|
|
if (strpos($path, $fileManagerFolder) === false) { |
|
|
|
$path = $fileManagerFolder . '/' . $path; |
|
|
|
$path = $fileManagerFolder.'/'.$path; |
|
|
|
} |
|
|
|
|
|
|
|
if (file_exists($path)) { |
|
|
@@ -88,7 +112,7 @@ class TwigExtension extends AbstractExtension |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return $this->cacheManager->getBrowserPath($this->getFileManagerFolder() . '/' . $default, $thumb); |
|
|
|
return $this->cacheManager->getBrowserPath($this->getFileManagerFolder().'/'.$default, $thumb); |
|
|
|
} |
|
|
|
|
|
|
|
public function getFileManagerFolder() |
|
|
@@ -103,7 +127,7 @@ class TwigExtension extends AbstractExtension |
|
|
|
|
|
|
|
public function getParameter($name) |
|
|
|
{ |
|
|
|
return $this->parameterBag->get($name) ; |
|
|
|
return $this->parameterBag->get($name); |
|
|
|
} |
|
|
|
|
|
|
|
} |