Passing data to your hookables
Last updated
Last updated
One of the most powerful aspects of hooks & hookables is an ability to pass their data down to the children. We can have two sources of the context data:
Hook-level defined data
Hookable-level defined data
The context data from these two sources are merged and passed with the metadata to the hookable template or component, so we can use them.
So, as we see at line 8
we define the index.form
hook. But also, we pass the form
with using the with
keyword. Thanks to it, we are able to pass multiple data to hookables that will hook into the index.form
hook.
Now let's create a Twig template rendering some field from our form, and let's make it a hookable.