Browse Source

Intégration app product

develop
Fab 3 years ago
parent
commit
7c5a60e04c
2 changed files with 30 additions and 6 deletions
  1. +2
    -2
      Controller/Dashboard/DashboardAdminController.php
  2. +28
    -4
      Twig/TwigExtension.php

+ 2
- 2
Controller/Dashboard/DashboardAdminController.php View File

'main_menu' => '@LcSov/adminlte/block/menu.html.twig', 'main_menu' => '@LcSov/adminlte/block/menu.html.twig',
'crud/index' => '@LcSov/adminlte/crud/index.html.twig', 'crud/index' => '@LcSov/adminlte/crud/index.html.twig',
'crud/paginator' => '@LcSov/adminlte/crud/paginator.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', 'flash_messages' => '@LcSov/adminlte/block/flash_messages.html.twig',
] ]
) )

+ 28
- 4
Twig/TwigExtension.php View File

new TwigFunction('sov_get_by_devalias', [$this, 'getByDevAlias']), new TwigFunction('sov_get_by_devalias', [$this, 'getByDevAlias']),
new TwigFunction('sov_parameter', [$this, 'getParameter']), new TwigFunction('sov_parameter', [$this, 'getParameter']),
new TwigFunction('sov_homepage_route', [$this, 'getHomepageRoute']), 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() 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') public function liip($path, $thumb = 'tile', $default = 'default.jpg')
$fileManagerFolder = substr($this->getFileManagerFolder(), 1); $fileManagerFolder = substr($this->getFileManagerFolder(), 1);


if (strpos($path, $fileManagerFolder) === false) { if (strpos($path, $fileManagerFolder) === false) {
$path = $fileManagerFolder . '/' . $path;
$path = $fileManagerFolder.'/'.$path;
} }


if (file_exists($path)) { if (file_exists($path)) {
} }
} }


return $this->cacheManager->getBrowserPath($this->getFileManagerFolder() . '/' . $default, $thumb);
return $this->cacheManager->getBrowserPath($this->getFileManagerFolder().'/'.$default, $thumb);
} }


public function getFileManagerFolder() public function getFileManagerFolder()


public function getParameter($name) public function getParameter($name)
{ {
return $this->parameterBag->get($name) ;
return $this->parameterBag->get($name);
} }


} }

Loading…
Cancel
Save