Skip to content

Commit

Permalink
MaterialChoiceTableType introduce display_total_items option
Browse files Browse the repository at this point in the history
  • Loading branch information
PululuK committed Mar 4, 2024
1 parent 54d803c commit 8f5ad23
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
),
'empty_data' => [],
'choices' => $this->groupByIdChoiceProvider->getChoices(),
'display_total_items' => true,
])
->add('default_group_id', GroupType::class, [
'label' => $this->trans('Default customer group', 'Admin.Orderscustomers.Feature'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public function configureOptions(OptionsResolver $resolver)
$resolver->setDefaults([
'expanded' => true,
'multiple' => true,
'display_total_items' => false,
]);
}

Expand All @@ -62,6 +63,7 @@ public function getParent()
public function buildView(FormView $view, FormInterface $form, array $options): void
{
$view->vars['isCheckSelectAll'] = count($form->getViewData()) === count($options['choices']);
$view->vars['displayTotalItems'] = (bool) $options['display_total_items'];
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@
{% endif %}
>
<i class="md-checkbox-control"></i>
{{ 'Select all'|trans({}, 'Admin.Actions') }}
{{ 'Select all'|trans({}, 'Admin.Actions') }} {% if form.vars.displayTotalItems %} ({{ form|length }}) {% endif %}
</label>
</div>
</th>
Expand Down

0 comments on commit 8f5ad23

Please sign in to comment.