Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed duplicated classes in form_fields.html.twig #853

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@

{% block form_row_subfield -%}
{% set wrapper_class = 'ibexa-data-source__field ibexa-data-source__field--' ~ name %}
{% if required %}{% set wrapper_class = (wrapper_class ~ ' ibexa-data-source__field--required ibexa-data-source__field--required')|trim %}{% endif %}
{% if required %}{% set wrapper_class = (wrapper_class ~ ' ibexa-data-source__field--required')|trim %}{% endif %}
{% if errors|length > 0 %}{% set wrapper_class = (wrapper_class|default('') ~ ' is-invalid')|trim %}{% endif %}

{% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' ibexa-label ibexa-data-source__label ibexa-data-source__label')|trim}) %}
{% set label_wrapper_attr = label_wrapper_attr|default({})|merge({'class': (label_wrapper_attr.class|default('') ~ ' ibexa-data-source__label-wrapper ibexa-data-source__label-wrapper')|trim}) %}
{% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' ibexa-label ibexa-data-source__label')|trim}) %}
Copy link
Contributor

@tischsoic tischsoic Aug 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure whether we should delete these duplicates. When we try to trace back where they come from we can see that first they were duplicated to have both ibexa- and ez-.

  1. c5cb76b#diff-3776f7fe593a6a85de0c62980e813efe1256ea7398646bff8c34a16ad83d91aaR45
  2. and then ez- was changed to ibexa- in this PR probably by a mistake:
    a4bdc57#diff-3776f7fe593a6a85de0c62980e813efe1256ea7398646bff8c34a16ad83d91aaR47

So probably we should revert duplicates to ez- to revert changes from 2nd PR? But maybe we no longer want to have ez-, especially given we have already version 4.5?

Suggested change
{% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' ibexa-label ibexa-data-source__label')|trim}) %}
{% if required %}{% set wrapper_class = (wrapper_class ~ ' ibexa-data-source__field--required ez-data-source__field--required')|trim %}{% endif %}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As main branch currently points to 5.0 we can safely forget about ez- counterpart. @tischsoic Could you please take over this PR ?

{% set label_wrapper_attr = label_wrapper_attr|default({})|merge({'class': (label_wrapper_attr.class|default('') ~ ' ibexa-data-source__label-wrapper')|trim}) %}
{% set attr = attr|merge({
class: (attr.class|default('') ~ ' ibexa-data-source__input ibexa-data-source__input ibexa-input--small')|trim,
class: (attr.class|default('') ~ ' ibexa-data-source__input ibexa-input--small')|trim,
is_small: true,
}) %}
{% set wrapper_attr = wrapper_attr|default({})|merge({class: (wrapper_attr.class|default('') ~ ' ' ~ wrapper_class)|trim}) %}
{% set widget_wrapper_attr = widget_wrapper_attr|default({})|merge({class: (widget_wrapper_attr.class|default('') ~ ' ibexa-data-source__input-wrapper ibexa-data-source__input-wrapper')|trim}) %}
{% set widget_wrapper_attr = widget_wrapper_attr|default({})|merge({class: (widget_wrapper_attr.class|default('') ~ ' ibexa-data-source__input-wrapper')|trim}) %}

{% if required %}{% set label_attr = label_attr|merge({'class': label_attr.class ~ ' required' }) %}{% endif %}

Expand All @@ -81,11 +81,11 @@
{% set translation_mode = fieldtype.vars.mainLanguageCode != fieldtype.vars.languageCode %}
{% set fieldtype_is_not_translatable = translation_mode and not fieldtype.vars.value.fieldDefinition.isTranslatable %}

{% set widget_wrapper_attr = widget_wrapper_attr|default({})|merge({'class': (widget_wrapper_attr.class|default('') ~ ' ibexa-field-edit__data ibexa-field-edit__data')|trim}) %}
{% set wrapper_class = 'ibexa-field-edit ibexa-field-edit--' ~ fieldtype_identifier ~ ' ibexa-field-edit ibexa-field-edit--' ~ fieldtype_identifier %}
{% set widget_wrapper_attr = widget_wrapper_attr|default({})|merge({'class': (widget_wrapper_attr.class|default('') ~ ' ibexa-field-edit__data')|trim}) %}
{% set wrapper_class = 'ibexa-field-edit ibexa-field-edit--' ~ fieldtype_identifier %}

{% if fieldtype.vars.disabled %}
{% set wrapper_class = wrapper_class ~ ' ibexa-field-edit--disabled ibexa-field-edit--disabled' %}
{% set wrapper_class = wrapper_class ~ ' ibexa-field-edit--disabled' %}
{% set attr = attr|merge({'readonly': 'readonly'}) %}
{% endif %}

Expand All @@ -96,15 +96,15 @@
{% endif %}
{% endfor %}

{% if required %}{% set wrapper_class = (wrapper_class|default('') ~ ' ibexa-field-edit--required ibexa-field-edit--required')|trim %}{% endif %}
{% if required %}{% set wrapper_class = (wrapper_class|default('') ~ ' ibexa-field-edit--required')|trim %}{% endif %}
{% if errors|length > 0 %}{% set wrapper_class = (wrapper_class|default('') ~ ' is-invalid')|trim %}{% endif %}
{% if fieldtype_is_not_translatable %}
{% set wrapper_class = (wrapper_class|default('') ~ ' ibexa-field-edit--nontranslatable ibexa-field-edit--nontranslatable')|trim %}
{% set wrapper_class = (wrapper_class|default('') ~ ' ibexa-field-edit--nontranslatable')|trim %}
{% set attr = attr|merge({'readonly': 'readonly'}) %}
{% endif %}
{% set label_wrapper_attr = label_wrapper_attr|default({})|merge({'class': (label_wrapper_attr.class|default('') ~ 'ibexa-field-edit__label-wrapper ibexa-field-edit__label-wrapper')|trim}) %}
{% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' ibexa-label ibexa-field-edit__label ibexa-field-edit__label')|trim}) %}
{% set attr = attr|merge({'class': (attr.class|default('') ~ ' ibexa-data-source__input ibexa-data-source__input')|trim}) %}
{% set label_wrapper_attr = label_wrapper_attr|default({})|merge({'class': (label_wrapper_attr.class|default('') ~ 'ibexa-field-edit__label-wrapper')|trim}) %}
{% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' ibexa-label ibexa-field-edit__label')|trim}) %}
{% set attr = attr|merge({'class': (attr.class|default('') ~ ' ibexa-data-source__input')|trim}) %}
{% set wrapper_attr = wrapper_attr|default({})|merge({'class': (wrapper_attr.class|default('') ~ ' ' ~ wrapper_class)|trim}) %}

{% set field_type_descriptions = fieldtype.vars.value.fieldDefinition.descriptions %}
Expand All @@ -128,7 +128,7 @@
{% endif %}

{% if fieldtype_is_not_translatable %}
<p class="ibexa-field-edit__nontranslatable ibexa-field-edit__nontranslatable text-secondary">{{ 'fieldtype.translation_is_disabled'|trans({'%fieldName%': label})|desc('Translating the %fieldName% Field is disabled. See Content Type definition for details.') }}</p>
<p class="ibexa-field-edit__nontranslatable text-secondary">{{ 'fieldtype.translation_is_disabled'|trans({'%fieldName%': label})|desc('Translating the %fieldName% Field is disabled. See Content Type definition for details.') }}</p>
{% endif %}

{% set description = field_type_descriptions[fieldtype.vars.languageCode]|default(field_type_descriptions|first) %}
Expand Down
Loading