// lcLiip | // lcLiip | ||||
public function liip($path, $thumb = 'tile', $default = 'default.jpg') | public function liip($path, $thumb = 'tile', $default = 'default.jpg') | ||||
{ | { | ||||
if (substr($path, 0, 1) === '/') $path = substr($path, 1); | |||||
if (substr($path, 0, 1) === '/') { | |||||
$path = substr($path, 1); | |||||
} | |||||
if ($path) { | if ($path) { | ||||
$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; |
{% trans_default_domain ea.i18n.translationDomain %} | {% trans_default_domain ea.i18n.translationDomain %} | ||||
{% block body_id 'ea-detail-' ~ entity.name ~ '-' ~ entity.primaryKeyValue %} | |||||
{% block body_class 'ea-detail ea-detail-' ~ entity.name %} | |||||
{% block content_title %} | {% block content_title %} | ||||
{{ 'detail'|sov_trans_admin_title(ea.getEntity().getFqcn()) }} | {{ 'detail'|sov_trans_admin_title(ea.getEntity().getFqcn()) }} | ||||
{% endblock %} | {% endblock %} |
{% block color %}{{ color }}{% endblock %} | {% block color %}{{ color }}{% endblock %} | ||||
{% block icon %}{{ icon }}{% endblock %} | {% block icon %}{{ icon }}{% endblock %} | ||||
{% block title %}{{ title }}{% endblock %} | {% block title %}{{ title }}{% endblock %} | ||||
{% block content %}{{ content }}{% endblock %} | |||||
{% block content %}{{ content|raw }}{% endblock %} | |||||
{% block button %}{{ button }}{% endblock %} | {% block button %}{{ button }}{% endblock %} | ||||
{% endembed %} | {% endembed %} | ||||
{% endmacro %} | {% endmacro %} |
); | ); | ||||
} | } | ||||
public function transCard($cardName, $entityClass): string | |||||
{ | |||||
return $this->transEntityThenDefault( | |||||
$this->buildTransIdCard($cardName, $entityClass), | |||||
$this->buildTransIdCard($cardName, $entityClass, true) | |||||
); | |||||
} | |||||
public function transBox($cardName, $entityClass): string | |||||
{ | |||||
return $this->transEntityThenDefault( | |||||
$this->buildTransIdBox($cardName, $entityClass), | |||||
$this->buildTransIdBox($cardName, $entityClass, true) | |||||
); | |||||
} | |||||
public function transTitle($pageName, $entityClass = null, $params = []): string | public function transTitle($pageName, $entityClass = null, $params = []): string | ||||
{ | { | ||||
$entityName = $this->getEntityName($entityClass); | $entityName = $this->getEntityName($entityClass); | ||||
return $this->buildTransIdEntitySection($panelName, $entityClass, 'panels', $default); | return $this->buildTransIdEntitySection($panelName, $entityClass, 'panels', $default); | ||||
} | } | ||||
private function buildTransIdCard($cardName, $entityClass, $default = false): string | |||||
{ | |||||
return $this->buildTransIdEntitySection($cardName, $entityClass, 'cards', $default); | |||||
} | |||||
private function buildTransIdBox($boxName, $entityClass, $default = false): string | |||||
{ | |||||
return $this->buildTransIdEntitySection($boxName, $entityClass, 'boxes', $default); | |||||
} | |||||
private function buildTransIdEntitySection($name, $entityClass, $entitySection, $default): string | private function buildTransIdEntitySection($name, $entityClass, $entitySection, $default): string | ||||
{ | { | ||||
if ($default) { | if ($default) { | ||||
} | } | ||||
} | } | ||||
?> | |||||
?> |
new TwigFilter('sov_trans_admin_field', [$this, 'transAdminField']), | new TwigFilter('sov_trans_admin_field', [$this, 'transAdminField']), | ||||
new TwigFilter('sov_trans_admin_help', [$this, 'transAdminHelp']), | new TwigFilter('sov_trans_admin_help', [$this, 'transAdminHelp']), | ||||
new TwigFilter('sov_trans_admin_panel', [$this, 'transAdminPanel']), | new TwigFilter('sov_trans_admin_panel', [$this, 'transAdminPanel']), | ||||
new TwigFilter('sov_trans_admin_card', [$this, 'transAdminCard']), | |||||
new TwigFilter('sov_trans_admin_box', [$this, 'transAdminBox']), | |||||
new TwigFilter('sov_trans_admin_menu', [$this, 'transAdminMenu']), | new TwigFilter('sov_trans_admin_menu', [$this, 'transAdminMenu']), | ||||
new TwigFilter('sov_trans_admin_title', [$this, 'transAdminTitle']), | new TwigFilter('sov_trans_admin_title', [$this, 'transAdminTitle']), | ||||
new TwigFilter('sov_trans_admin_action', [$this, 'transAdminAction']), | new TwigFilter('sov_trans_admin_action', [$this, 'transAdminAction']), | ||||
return $this->translatorAdmin->transPanel($panelName, $entityClass); | return $this->translatorAdmin->transPanel($panelName, $entityClass); | ||||
} | } | ||||
public function transAdminBox($boxName, $entityClass= 'default') | |||||
{ | |||||
return $this->translatorAdmin->transBox($boxName, $entityClass); | |||||
} | |||||
public function transAdminCard($cardName, $entityClass) | |||||
{ | |||||
return $this->translatorAdmin->transCard($cardName, $entityClass); | |||||
} | |||||
public function transAdminMenu($menuName) | public function transAdminMenu($menuName) | ||||
{ | { | ||||
return $this->translatorAdmin->transMenu($menuName);; | return $this->translatorAdmin->transMenu($menuName);; |
use App\Repository\ReminderRepository; | use App\Repository\ReminderRepository; | ||||
use Doctrine\ORM\EntityManagerInterface; | use Doctrine\ORM\EntityManagerInterface; | ||||
use Lc\SovBundle\Component\DateComponent; | use Lc\SovBundle\Component\DateComponent; | ||||
use Lc\SovBundle\Component\FileComponent; | |||||
use Lc\SovBundle\Component\MetaComponent; | use Lc\SovBundle\Component\MetaComponent; | ||||
use Lc\SovBundle\Component\StringComponent; | use Lc\SovBundle\Component\StringComponent; | ||||
use Lc\SovBundle\Form\Newsletter\NewsletterType; | use Lc\SovBundle\Form\Newsletter\NewsletterType; | ||||
protected StringComponent $stringComponent; | protected StringComponent $stringComponent; | ||||
protected MetaComponent $metaComponent; | protected MetaComponent $metaComponent; | ||||
protected DateComponent $dateComponent; | protected DateComponent $dateComponent; | ||||
protected FileComponent $fileComponent; | |||||
public function __construct( | public function __construct( | ||||
KernelInterface $kernel, | KernelInterface $kernel, | ||||
FormFactoryInterface $formFactory, | FormFactoryInterface $formFactory, | ||||
StringComponent $stringComponent, | StringComponent $stringComponent, | ||||
MetaComponent $metaComponent, | MetaComponent $metaComponent, | ||||
DateComponent $dateComponent | |||||
DateComponent $dateComponent, | |||||
FileComponent $fileComponent | |||||
) { | ) { | ||||
$this->kernel = $kernel; | $this->kernel = $kernel; | ||||
$this->parameterBag = $parameterBag; | $this->parameterBag = $parameterBag; | ||||
$this->stringComponent = $stringComponent; | $this->stringComponent = $stringComponent; | ||||
$this->metaComponent = $metaComponent; | $this->metaComponent = $metaComponent; | ||||
$this->dateComponent = $dateComponent; | $this->dateComponent = $dateComponent; | ||||
$this->fileComponent = $fileComponent; | |||||
} | } | ||||
public function getFunctions() | public function getFunctions() | ||||
public function liip($path, $thumb = 'tile', $default = 'default.jpg') | public function liip($path, $thumb = 'tile', $default = 'default.jpg') | ||||
{ | { | ||||
if (substr($path, 0, 1) === '/') { | |||||
$path = substr($path, 1); | |||||
} | |||||
if ($path) { | |||||
$fileManagerFolder = substr($this->getFileManagerFolder(), 1); | |||||
if (strpos($path, $fileManagerFolder) === false) { | |||||
$path = $fileManagerFolder . '/' . $path; | |||||
} | |||||
if (file_exists($path)) { | |||||
return $this->cacheManager->getBrowserPath($path, $thumb); | |||||
} | |||||
} | |||||
return $this->cacheManager->getBrowserPath($this->getFileManagerFolder() . '/' . $default, $thumb); | |||||
$this->fileComponent->liip($path, $thumb, $default); | |||||
} | } | ||||
public function getFileManagerFolder() | public function getFileManagerFolder() | ||||
public function slugify($string) | public function slugify($string) | ||||
{ | { | ||||
return $this->stringComponent->slugify($string) ; | |||||
return $this->stringComponent->slugify($string); | |||||
} | } | ||||
public function getUserCurrent() | public function getUserCurrent() |