Jump to content

Duplicated help content in module Symfony form


rboada

Recommended Posts

Hello,

I'm developing a module that allows to download products according to filters selected by the user.

The development is done with Symfony, and I have a problem with the "help" property of a form input, specifically the input to display the category tree.

This is the current code:

/**
 * Build the form for download template with filters
 *
 * @param FormBuilderInterface $builder
 * @param array $options
 *
 * @return void
 */
public function buildForm(FormBuilderInterface $builder, array $options)
{
    $builder
        ->add('id_categories', CategoryChoiceTreeType::class, [
            'required' => false,
            'label' => $this->translator->trans('Category', [], 'Admin.Global'),
            'multiple' => true,
            'choices_tree' => $this->getNestedCategories(),
            'help' => $this->translator->trans(
                'You can select one or more categories to filter the products.',
                [],
                'Modules.Mymodule.Admin'
            ),
        ])
        ->add('from', DateType::class, [
            'required' => false,
            'label' => $this->translator->trans('From', [], 'Admin.Global'),
            'widget' => 'single_text',
            'format' => 'yyyy-MM-dd',
            'help' => $this->translator->trans(
                'Filter products added from this date.',
                [],
                'Modules.Mymodule.Admin'
            ),
        ])
        ->add('to', DateType::class, [
            'required' => false,
            'label' => $this->translator->trans('To', [], 'Admin.Global'),
            'widget' => 'single_text',
            'format' => 'yyyy-MM-dd',
            'help' => $this->translator->trans(
                'Filter products added to this date.',
                [],
                'Modules.Mymodule.Admin'
            ),
        ])
        ->add('filters_info', CustomContentType::class, [
            'required' => false,
            'template' => '@Modules/mymodule/views/templates/admin/filters-info.html.twig',
            'data' => [],
        ])
    ;
}

This is how the form looks in PrestaShop 1.7.8.11:

image.thumb.png.8edc9f13ffa9455034680134d1479c80.png

And this is what the form looks like in PrestaShop 8.1.5:

image.thumb.png.af3e9fbc309a0eacfcd83a368722e793.png

For some reason the help text is being duplicated, but only with the CategoryChoiceTreeType.

Can you guys help me?

Thanks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...