diff --git a/src/Resources/views/BlockAdmin/compose_preview.html.twig b/src/Resources/views/BlockAdmin/compose_preview.html.twig index 68c8eeb2a..aa21d14a3 100644 --- a/src/Resources/views/BlockAdmin/compose_preview.html.twig +++ b/src/Resources/views/BlockAdmin/compose_preview.html.twig @@ -7,25 +7,29 @@ - {% set service = attribute(blockServices, child.type) %} - {% if service.metadata is defined %} - {% set metadata = service.metadata %} + {% set service = attribute(blockServices, child.type) ?? null %} + {% if service is not null %} + {% if service.metadata is defined %} + {% set metadata = service.metadata %} + {% else %} + {% set metadata = service.blockMetadata %} + {% endif %} +

+ {{ child.name|default(metadata.title)|trans({}, metadata.domain|default('SonataPageBundle')) }} +

+ {% if not metadata.image %} + + {% else %} + + {% endif %} + {{ metadata.title|trans({}, metadata.domain|default('SonataPageBundle')) }} + + + + {% else %} - {% set metadata = service.blockMetadata %} + {{ child.type }} {% endif %} -

- {{ child.name|default(metadata.title)|trans({}, metadata.domain|default('SonataPageBundle')) }} -

- {% if not metadata.image %} - - {% else %} - - {% endif %} - {{ metadata.title|trans({}, metadata.domain|default('SonataPageBundle')) }} - - - -
@@ -33,37 +37,45 @@ {{ 'composer.remove'|trans({}, 'SonataPageBundle') }}
-
')|e }}" - data-label-disable="{{ ('composer.disable'|trans({}, 'SonataPageBundle') ~ ' ')|e }}" - > - - {% if child.enabled %}{{ 'composer.disable'|trans({}, 'SonataPageBundle') }} - - {% else %} - {{ 'composer.enable'|trans({}, 'SonataPageBundle') }} - - {% endif %} - -
+ {% if service is not null %} + +
')|e }}" + data-label-disable="{{ ('composer.disable'|trans({}, 'SonataPageBundle') ~ ' ')|e }}" + > + + {% if child.enabled %}{{ 'composer.disable'|trans({}, 'SonataPageBundle') }} + + {% else %} + {{ 'composer.enable'|trans({}, 'SonataPageBundle') }} + + {% endif %} + +
+ + {% endif %}
-
-
+ {% if service is not null %} -
- {{ 'loading'|trans({}, 'SonataPageBundle') }} -
+
+
+ +
+ {{ 'loading'|trans({}, 'SonataPageBundle') }} +
+ + {% endif %}