render_box address: new options and render modes

This commit is contained in:
2021-07-30 14:17:16 +02:00
parent 08cd6c81f2
commit 31c5c8b52a
5 changed files with 153 additions and 48 deletions

View File

@@ -10,16 +10,20 @@ class AddressRender implements ChillEntityRenderInterface
private EngineInterface $templating;
public const DEFAULT_OPTIONS = [
'with_valid_from' => true,
'with_valid_from' => false,
'with_valid_to' => false,
'with_picto' => false,
'with_delimiter' => false,
'has_no_address' => false,
'multiline' => true,
'extended_infos' => false
];
public function __construct(EngineInterface $templating)
{
$this->templating = $templating;
}
/**
* {@inheritDoc}
*/
@@ -56,11 +60,12 @@ class AddressRender implements ChillEntityRenderInterface
*/
public function renderBox($addr, array $options): string
{
$options = \array_merge(self::DEFAULT_OPTIONS, $options);
$options = \array_merge(self::DEFAULT_OPTIONS, $options);
return $this->templating
->render('@ChillMain/Address/entity_render.html.twig', [
->render('@ChillMain/Entity/address.html.twig', [
'address' => $addr,
'render' => $options['render'] ?? 'bloc',
'options' => $options
]);
}