mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
[chill entity render] fix usage of default entity rendering
This commit is contained in:
parent
a5c9562a4b
commit
d5e9747e80
@ -110,3 +110,5 @@ Master branch
|
||||
=============
|
||||
|
||||
- [translation] in french, replace "Modifier" by "Enregistrer" in the edit form
|
||||
- [chill entity render] fix error when fallback to default entity render (usage of __toString())
|
||||
|
||||
|
@ -33,7 +33,7 @@ class ChillEntityRender extends AbstractChillEntityRender
|
||||
|
||||
public function renderString($entity, array $options): string
|
||||
{
|
||||
return $entity;
|
||||
return (string) $entity;
|
||||
}
|
||||
|
||||
public function supports($entity, array $options): bool
|
||||
|
@ -41,6 +41,11 @@ class ChillEntityRenderExtension extends AbstractExtension
|
||||
*/
|
||||
protected $defaultRender;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->defaultRender = new ChillEntityRender();
|
||||
}
|
||||
|
||||
public function getFilters()
|
||||
{
|
||||
return [
|
||||
@ -55,12 +60,20 @@ class ChillEntityRenderExtension extends AbstractExtension
|
||||
|
||||
public function renderString($entity, array $options = []): string
|
||||
{
|
||||
if (NULL === $entity) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->getRender($entity, $options)
|
||||
->renderString($entity, $options);
|
||||
}
|
||||
|
||||
public function renderBox($entity, array $options = []): string
|
||||
{
|
||||
if (NULL === $entity) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->getRender($entity, $options)
|
||||
->renderBox($entity, $options);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user