22nd January 2023 - 26 minutes read time
I previously looked at injecting context providers into context aware plugins. This time I will explore more about creating our own context providers to plug into this system.
The context provider system is an ideal way to provide context to context aware plugins, with blocks being the prime example. You would use a context provider to inject an entity or value into the block so that actions can be taken using that data.
For example, we could load the currently loaded node from the route object using the context so that we didn't have to bake the route provider logic into the block.
The values we inject also plug into the cache systems and so we don't need to worry about making sure we integrate the cache systems within the block system. That is all taken care of upstream.