Skip to content

Commit 2b80337

Browse files
feat(autocomplete): add 'autocomplete' variable to the view vars
1 parent 3d6b8fc commit 2b80337

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Autocomplete/src/Form/AutocompleteChoiceTypeExtension.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ public static function getExtendedTypes(): iterable
3939
];
4040
}
4141

42-
public function finishView(FormView $view, FormInterface $form, array $options)
42+
public function finishView(FormView $view, FormInterface $form, array $options): void
4343
{
4444
if (!$options['autocomplete']) {
45+
$view->vars['autocomplete'] = false;
4546
return;
4647
}
4748

@@ -83,10 +84,11 @@ public function finishView(FormView $view, FormInterface $form, array $options)
8384
$attr['data-'.$controllerName.'-'.$name.'-value'] = $value;
8485
}
8586

87+
$view->vars['autocomplete'] = true;
8688
$view->vars['attr'] = $attr;
8789
}
8890

89-
public function configureOptions(OptionsResolver $resolver)
91+
public function configureOptions(OptionsResolver $resolver): void
9092
{
9193
$resolver->setDefaults([
9294
'autocomplete' => false,

0 commit comments

Comments
 (0)