Browse Source

Merge branch 'develop' of https://forge.laclic.fr/Laclic/SovBundle into develop

develop
Fab 3 years ago
parent
commit
a816e4115f
1 changed files with 11 additions and 1 deletions
  1. +11
    -1
      Twig/TwigExtension.php

+ 11
- 1
Twig/TwigExtension.php View File

return [ return [
new TwigFilter('uc_first', [$this, 'ucFirst']), new TwigFilter('uc_first', [$this, 'ucFirst']),
new TwigFilter('format_price', [$this, 'formatPrice']), new TwigFilter('format_price', [$this, 'formatPrice']),
new TwigFilter('sov_cache', [$this, 'sovCache']),
]; ];
} }


public function sovCache($file)
{
$cacheTime = filemtime($this->kernel->getProjectDir() . '/public' . $file);
if ($cacheTime) {
return $file . '?c=' . $cacheTime;
} else {
return $file . "?c=0";
}
}

public function formatPrice($price, $unbreakableSpace = true) public function formatPrice($price, $unbreakableSpace = true)
{ {
$price = number_format($price, 2, ',', ' '); $price = number_format($price, 2, ',', ' ');

Loading…
Cancel
Save