By phenaproxima on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.7.x
Introduced in version:
8.7.0
Issue links:
Description:
Many plugin types require context information to operate correctly. Individual plugins can define their required context definitions in their annotation using the 'context' key, like so:
<?php
/**
* Provides a 'User Role' condition.
*
* @Condition(
* id = "user_role",
* label = @Translation("User Role"),
* context = {
* "user" = @ContextDefinition("entity:user", label = @Translation("User"))
* }
* )
*/
class UserRole extends ConditionPluginBase {}
As of #3014949: Deprecate 'context' on Block and Condition plugin annotations in favor of 'context_definitions', the 'context' key is deprecated and replaced by 'context_definitions', which more accurately describes the contents of the array. The correct way for plugins to define context definitions is like so:
<?php
/**
* Provides a 'User Role' condition.
*
* @Condition(
* id = "user_role",
* label = @Translation("User Role"),
* context_definitions = {
* "user" = @ContextDefinition("entity:user", label = @Translation("User"))
* }
* )
*/
class UserRole extends ConditionPluginBase {}
Impacts:
Module developers