Skip to content

Commit

Permalink
bug #5992 fix wrong tabs layout on validation error after page reload…
Browse files Browse the repository at this point in the history
… (Julien Mariller)

This PR was squashed before being merged into the 4.x branch.

Discussion
----------

fix wrong tabs layout on validation error after page reload

This fixes #5980

Commits
-------

5c62209 fix wrong tabs layout on validation error after page reload
  • Loading branch information
javiereguiluz committed Nov 1, 2023
2 parents bf76d49 + 5c62209 commit b5c9b7a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/Factory/FormLayoutFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ private function linearizeLayoutConfiguration(FieldCollection $fields): void
'ea_tab_id' => $tabId,
'ea_css_class' => $fieldDto->getCssClass(),
'ea_help' => $fieldDto->getHelp(),
'ea_tab_is_active' => $isTabActive,
]);

$tabs[$tabId] = $fieldDto;
Expand Down
2 changes: 0 additions & 2 deletions src/Form/Type/Layout/EaFormTabPaneOpenType.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public function configureOptions(OptionsResolver $resolver): void
->define('ea_tab_id')->allowedTypes('string')
->define('ea_css_class')->default(null)->allowedTypes('string', 'null')
->define('ea_help')->default(null)->allowedTypes(TranslatableInterface::class, 'string', 'null')
->define('ea_tab_is_active')->default(false)->allowedTypes('boolean')
;
}

Expand All @@ -32,7 +31,6 @@ public function buildView(FormView $view, FormInterface $form, array $options):
$view->vars['ea_tab_id'] = $options['ea_tab_id'];
$view->vars['ea_css_class'] = $options['ea_css_class'];
$view->vars['ea_help'] = $options['ea_help'];
$view->vars['ea_tab_is_active'] = $options['ea_tab_is_active'];
}

public function getBlockPrefix(): string
Expand Down
4 changes: 3 additions & 1 deletion src/Resources/views/crud/form_theme.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -655,8 +655,10 @@
{% endblock ea_form_tabpane_group_close_row %}

{% block ea_form_tabpane_open_row %}
{% set tab_is_active_option_name = constant('EasyCorp\\Bundle\\EasyAdminBundle\\Field\\FormField::OPTION_TAB_IS_ACTIVE') %}
{% set field = form.vars.ea_vars.field %}
<div class="tab-content">
<div id="{{ ea_tab_id }}" class="tab-pane {% if ea_tab_is_active %}active{% endif %} {{ ea_css_class }}">
<div id="{{ ea_tab_id }}" class="tab-pane {% if field.getCustomOption(tab_is_active_option_name) %}active{% endif %} {{ ea_css_class }}">
{% if ea_help %}
<div class="content-header-help tab-help">
{{ ea_help|trans(domain = ea.i18n.translationDomain)|raw }}
Expand Down

0 comments on commit b5c9b7a

Please sign in to comment.