Przeglądaj źródła

Intégration frontend

feature/symfony6.1
Guillaume 2 lat temu
rodzic
commit
b96efe8905
1 zmienionych plików z 11 dodań i 1 usunięć
  1. +11
    -1
      Twig/TwigExtension.php

+ 11
- 1
Twig/TwigExtension.php Wyświetl plik

@@ -76,10 +76,20 @@ class TwigExtension extends AbstractExtension
return [
new TwigFilter('uc_first', [$this, 'ucFirst']),
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)
{
$price = number_format($price, 2, ',', ' ');

Ładowanie…
Anuluj
Zapisz