@@ -30,10 +30,13 @@ class FileComponent | |||
// lcLiip | |||
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) { | |||
$fileManagerFolder = substr($this->getFileManagerFolder(), 1) ; | |||
$fileManagerFolder = substr($this->getFileManagerFolder(), 1); | |||
if (strpos($path, $fileManagerFolder) === false) { | |||
$path = $fileManagerFolder . '/' . $path; |
@@ -5,9 +5,6 @@ | |||
{% 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 %} | |||
{{ 'detail'|sov_trans_admin_title(ea.getEntity().getFqcn()) }} | |||
{% endblock %} |
@@ -3,7 +3,7 @@ | |||
{% block color %}{{ color }}{% endblock %} | |||
{% block icon %}{{ icon }}{% endblock %} | |||
{% block title %}{{ title }}{% endblock %} | |||
{% block content %}{{ content }}{% endblock %} | |||
{% block content %}{{ content|raw }}{% endblock %} | |||
{% block button %}{{ button }}{% endblock %} | |||
{% endembed %} | |||
{% endmacro %} |
@@ -73,6 +73,21 @@ class TranslatorAdmin | |||
); | |||
} | |||
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 | |||
{ | |||
$entityName = $this->getEntityName($entityClass); | |||
@@ -126,6 +141,16 @@ class TranslatorAdmin | |||
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 | |||
{ | |||
if ($default) { | |||
@@ -157,4 +182,4 @@ class TranslatorAdmin | |||
} | |||
} | |||
?> | |||
?> |
@@ -44,6 +44,8 @@ class TranslatorTwigExtension extends AbstractExtension | |||
new TwigFilter('sov_trans_admin_field', [$this, 'transAdminField']), | |||
new TwigFilter('sov_trans_admin_help', [$this, 'transAdminHelp']), | |||
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_title', [$this, 'transAdminTitle']), | |||
new TwigFilter('sov_trans_admin_action', [$this, 'transAdminAction']), | |||
@@ -82,6 +84,18 @@ class TranslatorTwigExtension extends AbstractExtension | |||
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) | |||
{ | |||
return $this->translatorAdmin->transMenu($menuName);; |
@@ -5,6 +5,7 @@ namespace Lc\SovBundle\Twig; | |||
use App\Repository\ReminderRepository; | |||
use Doctrine\ORM\EntityManagerInterface; | |||
use Lc\SovBundle\Component\DateComponent; | |||
use Lc\SovBundle\Component\FileComponent; | |||
use Lc\SovBundle\Component\MetaComponent; | |||
use Lc\SovBundle\Component\StringComponent; | |||
use Lc\SovBundle\Form\Newsletter\NewsletterType; | |||
@@ -39,6 +40,7 @@ class TwigExtension extends AbstractExtension | |||
protected StringComponent $stringComponent; | |||
protected MetaComponent $metaComponent; | |||
protected DateComponent $dateComponent; | |||
protected FileComponent $fileComponent; | |||
public function __construct( | |||
KernelInterface $kernel, | |||
@@ -54,7 +56,8 @@ class TwigExtension extends AbstractExtension | |||
FormFactoryInterface $formFactory, | |||
StringComponent $stringComponent, | |||
MetaComponent $metaComponent, | |||
DateComponent $dateComponent | |||
DateComponent $dateComponent, | |||
FileComponent $fileComponent | |||
) { | |||
$this->kernel = $kernel; | |||
$this->parameterBag = $parameterBag; | |||
@@ -70,6 +73,7 @@ class TwigExtension extends AbstractExtension | |||
$this->stringComponent = $stringComponent; | |||
$this->metaComponent = $metaComponent; | |||
$this->dateComponent = $dateComponent; | |||
$this->fileComponent = $fileComponent; | |||
} | |||
public function getFunctions() | |||
@@ -130,24 +134,7 @@ class TwigExtension extends AbstractExtension | |||
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() | |||
@@ -183,7 +170,7 @@ class TwigExtension extends AbstractExtension | |||
public function slugify($string) | |||
{ | |||
return $this->stringComponent->slugify($string) ; | |||
return $this->stringComponent->slugify($string); | |||
} | |||
public function getUserCurrent() |