mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
entity render: options, html classes, corrections
note: span.chill-entity tag is replaced by section.chill-entity tag. because some cases are not valid html : * span.chill-entity > div * span.badge > div.chill-entity
This commit is contained in:
@@ -22,7 +22,7 @@ namespace Chill\ThirdPartyBundle\Templating\Entity;
|
||||
|
||||
use Chill\MainBundle\Templating\Entity\AbstractChillEntityRender;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use Symfony\Bridge\Twig\TwigEngine;
|
||||
use Symfony\Component\Templating\EngineInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -30,15 +30,12 @@ use Symfony\Bridge\Twig\TwigEngine;
|
||||
*/
|
||||
class ThirdPartyRender extends AbstractChillEntityRender
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var TwigEngine
|
||||
*/
|
||||
protected $templating;
|
||||
|
||||
public function __construct(TwigEngine $templating)
|
||||
protected EngineInterface $engine;
|
||||
|
||||
public function __construct(EngineInterface $engine)
|
||||
{
|
||||
$this->templating = $templating;
|
||||
$this->engine = $engine;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -49,17 +46,21 @@ class ThirdPartyRender extends AbstractChillEntityRender
|
||||
*/
|
||||
public function renderBox($entity, array $options): string
|
||||
{
|
||||
$params = [
|
||||
'with_valid_from' => $options['with_valid_from'] ?? true,
|
||||
'addLink' => $options['addLink'] ?? false,
|
||||
'addEntity' => $options['addEntity'] ?? false,
|
||||
'addInfo' => $options['addInfo'] ?? false,
|
||||
'hLevel' => $options['hLevel'] ?? 3,
|
||||
];
|
||||
|
||||
return
|
||||
$this->getDefaultOpeningBox('_3party').
|
||||
$this->templating->render('@ChillThirdParty/Entity/thirdparty.html.twig', [
|
||||
$this->getDefaultOpeningBox('thirdparty') .
|
||||
$this->engine->render('@ChillThirdParty/Entity/thirdparty.html.twig', [
|
||||
'thirdparty' => $entity,
|
||||
'with_valid_from' => $options['with_valid_from'] ?? true,
|
||||
'addLink' => $options['addLink'] ?? false,
|
||||
'addEntity' => $options['addEntity'] ?? false,
|
||||
'addInfo' => $options['addInfo'] ?? false,
|
||||
'display' => $options['display'] ?? 'raw',
|
||||
'options' => $options
|
||||
]).
|
||||
'render' => $options['render'] ?? 'raw',
|
||||
'options' => $params
|
||||
]) .
|
||||
$this->getDefaultClosingBox();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user