Condition.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace Drupal\Core\Condition\Annotation;
  3. use Drupal\Component\Annotation\Plugin;
  4. /**
  5. * Defines a condition plugin annotation object.
  6. *
  7. * Condition plugins provide generalized conditions for use in other
  8. * operations, such as conditional block placement.
  9. *
  10. * Plugin Namespace: Plugin\Condition
  11. *
  12. * For a working example, see \Drupal\user\Plugin\Condition\UserRole.
  13. *
  14. * @see \Drupal\Core\Condition\ConditionManager
  15. * @see \Drupal\Core\Condition\ConditionInterface
  16. * @see \Drupal\Core\Condition\ConditionPluginBase
  17. * @see block_api
  18. *
  19. * @ingroup plugin_api
  20. *
  21. * @Annotation
  22. */
  23. class Condition extends Plugin {
  24. /**
  25. * The condition plugin ID.
  26. *
  27. * @var string
  28. */
  29. public $id;
  30. /**
  31. * The human-readable name of the condition.
  32. *
  33. * @ingroup plugin_translatable
  34. *
  35. * @var \Drupal\Core\Annotation\Translation
  36. */
  37. public $label;
  38. /**
  39. * The name of the module providing the type.
  40. *
  41. * @var string
  42. */
  43. public $module;
  44. /**
  45. * An array of context definitions describing the context used by the plugin.
  46. *
  47. * The array is keyed by context names.
  48. *
  49. * @var \Drupal\Core\Annotation\ContextDefinition[]
  50. */
  51. public $context = [];
  52. /**
  53. * The category under which the condition should listed in the UI.
  54. *
  55. * @var \Drupal\Core\Annotation\Translation
  56. *
  57. * @ingroup plugin_translatable
  58. */
  59. public $category;
  60. }