Drupal 10: Using Context Definitions To Create Context Aware Plugins
When developing plugins in Drupal a common task is to inject context so that certain tasks can be performed. For example, we might have a block plugin that needs to know about the content entity of the page it is currently being rendered on. We could potentially inject the routing system into the plugin and use this to find the currently loaded entity, but there is a drawback to this.