Przeglądaj źródła

Intégration app product

feature/symfony6.1
Fab 3 lat temu
rodzic
commit
7c5a60e04c
2 zmienionych plików z 30 dodań i 6 usunięć
  1. +2
    -2
      Controller/Dashboard/DashboardAdminController.php
  2. +28
    -4
      Twig/TwigExtension.php

+ 2
- 2
Controller/Dashboard/DashboardAdminController.php Wyświetl plik

@@ -83,8 +83,8 @@ class DashboardAdminController extends AbstractDashboardController
'main_menu' => '@LcSov/adminlte/block/menu.html.twig',
'crud/index' => '@LcSov/adminlte/crud/index.html.twig',
'crud/paginator' => '@LcSov/adminlte/crud/paginator.html.twig',
'crud/edit' => '@LcSov/adminlte/crud/edit.html.twig',
'crud/new' => '@LcSov/adminlte/crud/new.html.twig',
'crud/edit' => '@LcSov/adminlte/crud/form.html.twig',
'crud/new' => '@LcSov/adminlte/crud/form.html.twig',
'flash_messages' => '@LcSov/adminlte/block/flash_messages.html.twig',
]
)

+ 28
- 4
Twig/TwigExtension.php Wyświetl plik

@@ -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);
}

}

Ładowanie…
Anuluj
Zapisz