-
-
Notifications
You must be signed in to change notification settings - Fork 364
[Autocomplete] New autocomplete type #1158
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well... this is incredible. I tested locally - it works fantastically! So, I just think we need to:
A) Deprecate the old stuff - so ParentEntityAutocompleteType
and AutocompleteEntityTypeSubscriber
B) Update the docs to show BaseEntityAutocompleteType
One thing that bothers me: in the ParentEntityAutocompleteType we have getBlockPrefix(): { return 'ux_entity_autocomplete'; }. If we'd add this to the new one, it'd break my custom form theme because I access form.autocomplete.vars.., should we set something new for block prefix?
Ah, I see what you're saying: if we return the same string, and your app has a mixture of old and new style fields, your one form theme will need to work for both situations. Are we sure we need to worry about this? When you start using the new way, you'll need to update your form theme anyway. And when you do, you can update all of your old usages to the new BaseEntityAutocompleteType
or make your form theme temporarily a bit smarter to check to see if form.autocomplete
is defineed. I'd vote for returning the same block prefix.
f343202
to
5623a97
Compare
Updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also update the docs? Probably updating all of the ParentEntityAuto...
-> BaseEntityAuto...
would be enough. Maybe also a versionadded
to mention that BaseEntityAuto...
is new in 2.13.
$container->prependExtensionConfig('twig', [ | ||
'form_themes' => ['@Autocomplete/autocomplete_form_theme.html.twig'], | ||
]); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I think I misspoke & misunderstood what you were saying about the form theme stuff. We need to keep this (for the "old" system). For the new type, I'm leaning towards not returning ANY special block prefix and just allowing the normal one to be used for the entity
type. If the user wants to theme something specifically for autocomplete entity types, I think they could probably do that via the uses_autocomplete
form theme variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've restored the template but not to remove ux_entity_autocomplete
block prefix, I've added checks to the template if we use new type or the old one and adapt
new Reference('router'), | ||
]) | ||
->addTag('form.type'); | ||
|
||
$container | ||
->register('ux.autocomplete.entity_type', ParentEntityAutocompleteType::class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we deprecate this service? Or does that trigger a deprecation SIMPLY because it's a valid form type (even if it's unused)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deprecated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Can you rebase and squash a little? I don't need 1 commit - but 2-3 would be fine. I can normally squash with our merge tool, but not with 2 authors - and we need a squash to remove that merge commit :)
19eda6d
to
9ab50fc
Compare
9ab50fc
to
9335587
Compare
Rebase & squash done |
Thank you Tomas you seriously rock! |
Continuation of work from @yceruto.
One thing that bothers me: in the
ParentEntityAutocompleteType
we havegetBlockPrefix(): { return 'ux_entity_autocomplete'; }
. If we'd add this to the new one, it'd break my custom form theme because I accessform.autocomplete.vars..
, should we set something new for block prefix?