Main Content

Conditional love

One of the more interesting additions to Drupal 8 is the core conditions API. Condition plugins are used to make decisions about all kinds of things like block visibility, layout choices, page manager variants, and even rules. Decisions can be based upon any available contextual information from the URL or session, as well as remote service calls, database queries, or almost any other source. 

I will walk through writing a simple condition plugin and then show some more complicated examples with configuration forms and unusual contexts.

This will not be a general overview of the plugin system, but will instead be focused on the real needs of developers and site builders implementing conditions using contrib modules or custom code.

Login to Register