mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-01 22:46:13 +00:00
do not throw an exception when null element are passed to chill_entity_render_box
and chill_entity_render_string
This commit is contained in:
parent
a5c9562a4b
commit
2aa9188fbc
@ -106,7 +106,8 @@ Version 1.5.15
|
|||||||
- [phonenumber validation] allow to validate against mobile **or** landline/voip phonenumbers;
|
- [phonenumber validation] allow to validate against mobile **or** landline/voip phonenumbers;
|
||||||
- [phonenumber validation & format] format and validation does not make the app fail when network is not available;
|
- [phonenumber validation & format] format and validation does not make the app fail when network is not available;
|
||||||
|
|
||||||
Master branch
|
Version 1.5.16
|
||||||
=============
|
==============
|
||||||
|
|
||||||
- [translation] in french, replace "Modifier" by "Enregistrer" in the edit form
|
- [translation] in french, replace "Modifier" by "Enregistrer" in the edit form
|
||||||
|
- [entity render] do not throw an exception when null element are passed to `chill_entity_render_box` and `chill_entity_render_string`
|
||||||
|
@ -55,12 +55,20 @@ class ChillEntityRenderExtension extends AbstractExtension
|
|||||||
|
|
||||||
public function renderString($entity, array $options = []): string
|
public function renderString($entity, array $options = []): string
|
||||||
{
|
{
|
||||||
|
if ($entity === NULL) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
return $this->getRender($entity, $options)
|
return $this->getRender($entity, $options)
|
||||||
->renderString($entity, $options);
|
->renderString($entity, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderBox($entity, array $options = []): string
|
public function renderBox($entity, array $options = []): string
|
||||||
{
|
{
|
||||||
|
if ($entity === null) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
return $this->getRender($entity, $options)
|
return $this->getRender($entity, $options)
|
||||||
->renderBox($entity, $options);
|
->renderBox($entity, $options);
|
||||||
}
|
}
|
||||||
@ -70,7 +78,7 @@ class ChillEntityRenderExtension extends AbstractExtension
|
|||||||
$this->renders[] = $render;
|
$this->renders[] = $render;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getRender($entity, $options): ChillEntityRenderInterface
|
protected function getRender($entity, $options): ?ChillEntityRenderInterface
|
||||||
{
|
{
|
||||||
foreach ($this->renders as $render) {
|
foreach ($this->renders as $render) {
|
||||||
if ($render->supports($entity, $options)) {
|
if ($render->supports($entity, $options)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user