{% macro custom_field_tabs(form, entityType, entityId) %} {% import _self as macros %} {% set customFieldSets = get_custom_field_sets_for_entity(entityType) %} {% if customFieldSets is not empty %}

{{ 'admin.custom_fields.title'|trans }}

{% for set in customFieldSets %}
{% if set.description %}

{{ set.description }}

{% endif %}
{% for field in set.customFields %} {% if field.active %} {# Code Editor and WYSIWYG should use full width #} {% set colClass = (field.type == 'code_editor' or field.type == 'wysiwyg') ? 'col-md-12' : 'col-md-6' %}
{% set fieldName = 'custom_field_' ~ field.technicalName %} {% if form[fieldName] is defined %} {# Prüfe ob es wirklich eine Checkbox ist (über block_prefixes - das ist zuverlässiger) #} {% set isCheckboxField = form[fieldName].vars.block_prefixes[1] is defined and form[fieldName].vars.block_prefixes[1] == 'checkbox' %} {% if isCheckboxField %} {% if field.description %} {{ field.description }} {% endif %}
{# Die Klasse form-check-input wird bereits vom CustomFieldService gesetzt #} {{ form_widget(form[fieldName]) }}
{% else %} {% if field.description %} {{ field.description }} {% endif %} {# Für Code-Editor und WYSIWYG: Klassen werden bereits vom CustomFieldService gesetzt #} {# Use existing classes from form options, don't override #} {% set existingClass = form[fieldName].vars.attr.class is defined ? form[fieldName].vars.attr.class : 'form-control' %} {{ form_widget(form[fieldName]) }} {% endif %} {{ form_errors(form[fieldName]) }} {% endif %}
{% endif %} {% endfor %}
{% endfor %}
{% endif %} {% endmacro %}