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
[HookBundle] Review if hook system can be simplified #4404
Comments
Of course, the original hooks implementation was designed by Drak when we used "regular" forms (and This is why with Core-2 I added the FormAware hooks category. These are intentionally designed for use in a Symfony Form aware workflow. FormAware hooks replace the 6 UiHooks related to form workflows. This leaves only probably we should immediately deprecate the "old 6" UiHooks and remove at 4.0. The old "manual" method of handling forms would not be 'hookable'. (probably this should have been done before Core-3 🙄) This would leave us with 3 categories:
(remember, that an extension developer may implement and utilize their own hook categories) From there, I believe implementation is simpler. We would need to better document the intention of each category.
Unify is an interesting word-choice here. I do not think we need to unify the categories (e.g. have only 1 category). Perhaps we can better document them in a more unified way or present a better DX. |
Unify was related to the implementation, i.e. same arguments and equal naming etc. |
Hooks were always confusing maybe because of my idea how it supposed to work. So for example to create BBSmiles functionality via hooks you have to create two hook providers BBSmiles Display hook (FormAware is not needed as we would use js to replace smiles in textarea) and BBSmiles Filter hook. For some reason there is no one "plane" on which an area is connected with its categories. It seems category is more important than area. Current provider id Current subscriber id So this way when I bind one bbcode provider to an "content" area all categories are matched automatically. I actually do not understand why some "operations on the content" are distinctive categories and others dont not. For example why filtering has its own category while validating or processing does not have it... Maybe there is a deeper reason why it is the way it is... One thing that I think is really missing is ability to add settings for a binding. So each connection have its own settings specified by hook provider. This way we one provider can act differently when hooked to a different subscriber. |
The current hook system is very inconsistent and therefore hard to understand.
One potentially confusing thing is that UI/display hooks are rendered outside of the main form, so if they provide something and rely on that being submitted it won't. So UI hooks mainly make sense for
TYPE_DISPLAY_VIEW
, the other six subtypes likeDISPLAY_EDIT
are very rarely needed (only if a hook provider wants to validate and process the subscriber data instead of providing additional form elements).So a typical hook provider (which offers and processes additional data) currently needs to offer both form aware and UI hook providers for a "complete" experience (adding custom form elements and displaying assigned data on view pages).
Also a site admin must know this and assign both providers to get things working.
Hence, we should rethink about whether it is possible to simplify the different hook types and unify how they are implemented.
The text was updated successfully, but these errors were encountered: