Skip to content

Commit 2ce3296

Browse files
committed
IBX-11436: Make logic for anchor-menu-items css classes reusable
1 parent 736b223 commit 2ce3296

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

src/bundle/Resources/views/themes/admin/ui/edit_base.html.twig

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
{% extends view_base_layout is defined ? view_base_layout : '@ibexadesign/ui/layout.html.twig' %}
22

3-
{% block main_container_class %}
4-
ibexa-main-container--edit-container
5-
6-
{%- set has_anchor_menu_items = anchor_params.items|default([])|length > 1 or ignored_content_fields|default([]) is not empty -%}
3+
{% macro anchor_container_classes(anchor_params, ignored_content_fields) %}
4+
{%- set has_anchor_menu_items = (anchor_params.items|default([])|length > 1)
5+
or (ignored_content_fields|default([]) is not empty) -%}
76
{%- set has_anchor_close_btn = anchor_params.close_href|default(null) is not empty -%}
87

9-
{{- has_anchor_menu_items ? ' ibexa-main-container--with-anchor-menu-items ' : ' ibexa-main-container--without-anchor-menu-items ' -}}
10-
{{- not has_anchor_close_btn ? ' ibexa-main-container--without-anchor-close-btn ' -}}
8+
{%- set classes = [ has_anchor_menu_items ? 'ibexa-main-container--with-' : 'ibexa-main-container--without-anchor-menu-items' ] -%}
9+
{%- set classes = classes|merge([ not has_anchor_close_btn ? 'ibexa-main-container--without-anchor-close-btn' : '' ]) -%}
10+
11+
{{- classes|join(' ') -}}
12+
{% endmacro %}
13+
14+
{% from _self import anchor_container_classes %}
15+
16+
{% block main_container_class %}
17+
ibexa-main-container--edit-container
18+
{{ anchor_container_classes(anchor_params|default({}), ignored_content_fields|default([])) }}
1119
{% endblock %}
1220

1321
{% block header_row %}{% endblock %}

0 commit comments

Comments
 (0)