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

Select2: disabled elements are hidden #2541

Open
sspooky13 opened this issue Jan 17, 2023 · 0 comments · May be fixed by #2542
Open

Select2: disabled elements are hidden #2541

sspooky13 opened this issue Jan 17, 2023 · 0 comments · May be fixed by #2542

Comments

@sspooky13
Copy link
Contributor

Describe the bug

If you wanna disable some elements in choice type but you wanna still show it, you can't. Actually, if you set element as disabled it will set as hidden

To Reproduce

  1. Go to product detail in administration
  2. Open file ProductFormType in your IDE
  3. into brand element add these lines
            ->add('brand', ChoiceType::class, [
                'required' => false,
                'choices' => $this->brandFacade->getAll(),
                'choice_label' => 'name',
                'choice_value' => 'id',
+               'choice_attr' => function (Brand $brand) {
+                   return [
+                       'disabled' => 'disabled',
+                   ];
+               },
                'placeholder' => t('-- Choose brand --'),
                'label' => t('Brand'),
            ])
  1. Refresh page with product detail in administration
  2. Open brand choice list and see nothing

Expected behavior

Disabled elements are disabled, not hidden

Environment (please complete the following information)

  • OS: Windows 11 with docker
  • Browser: Brave (chromium)
  • Version: actual master (in unnamed project doesn't work too, he is in version 9.1.2)
  • Device: Desktop computer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants