New! Drupal 10: Creating Custom Context ...

New! Drupal 10: Creating Custom Context Providers

Jan 22, 2023

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 current node from the route using context so that we didn't have to bake the route provider logic into the block.

Read more here: https://www.hashbangcode.com/article/drupal-10-creating-custom-context-providers

Enjoy this post?

Buy !# code (Hash Bang Code) a coffee

More from !# code (Hash Bang Code)