ConfigEvents.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <?php
  2. namespace Drupal\Core\Config;
  3. /**
  4. * Defines events for the configuration system.
  5. *
  6. * @see \Drupal\Core\Config\ConfigCrudEvent
  7. */
  8. final class ConfigEvents {
  9. /**
  10. * Name of the event fired when saving a configuration object.
  11. *
  12. * This event allows modules to perform an action whenever a configuration
  13. * object is saved. The event listener method receives a
  14. * \Drupal\Core\Config\ConfigCrudEvent instance.
  15. *
  16. * See hook_update_N() documentation for safe configuration API usage and
  17. * restrictions as this event will be fired when configuration is saved by
  18. * hook_update_N().
  19. *
  20. * @Event
  21. *
  22. * @see \Drupal\Core\Config\ConfigCrudEvent
  23. * @see \Drupal\Core\Config\Config::save()
  24. * @see \Drupal\Core\Config\ConfigFactory::onConfigSave()
  25. * @see hook_update_N()
  26. *
  27. * @var string
  28. */
  29. const SAVE = 'config.save';
  30. /**
  31. * Name of the event fired when deleting a configuration object.
  32. *
  33. * This event allows modules to perform an action whenever a configuration
  34. * object is deleted. The event listener method receives a
  35. * \Drupal\Core\Config\ConfigCrudEvent instance.
  36. *
  37. * See hook_update_N() documentation for safe configuration API usage and
  38. * restrictions as this event will be fired when configuration is deleted by
  39. * hook_update_N().
  40. *
  41. * @Event
  42. *
  43. * @see \Drupal\Core\Config\ConfigCrudEvent
  44. * @see \Drupal\Core\Config\Config::delete()
  45. * @see \Drupal\Core\Config\ConfigFactory::onConfigDelete()
  46. * @see hook_update_N()
  47. *
  48. * @var string
  49. */
  50. const DELETE = 'config.delete';
  51. /**
  52. * Name of the event fired when renaming a configuration object.
  53. *
  54. * This event allows modules to perform an action whenever a configuration
  55. * object's name is changed. The event listener method receives a
  56. * \Drupal\Core\Config\ConfigRenameEvent instance.
  57. *
  58. * See hook_update_N() documentation for safe configuration API usage and
  59. * restrictions as this event will be fired when configuration is renamed by
  60. * hook_update_N().
  61. *
  62. * @Event
  63. *
  64. * @see \Drupal\Core\Config\ConfigRenameEvent
  65. * @see \Drupal\Core\Config\ConfigFactoryInterface::rename()
  66. * @see hook_update_N()
  67. *
  68. * @var string
  69. */
  70. const RENAME = 'config.rename';
  71. /**
  72. * Name of the event fired when validating imported configuration.
  73. *
  74. * This event allows modules to perform additional validation operations when
  75. * configuration is being imported. The event listener method receives a
  76. * \Drupal\Core\Config\ConfigImporterEvent instance.
  77. *
  78. * @Event
  79. *
  80. * @see \Drupal\Core\Config\ConfigImporterEvent
  81. * @see \Drupal\Core\Config\ConfigImporter::validate().
  82. * @see \Drupal\Core\EventSubscriber\ConfigImportSubscriber::onConfigImporterValidate().
  83. *
  84. * @var string
  85. */
  86. const IMPORT_VALIDATE = 'config.importer.validate';
  87. /**
  88. * Name of the event fired when importing configuration to target storage.
  89. *
  90. * This event allows modules to perform additional actions when configuration
  91. * is imported. The event listener method receives a
  92. * \Drupal\Core\Config\ConfigImporterEvent instance.
  93. *
  94. * @Event
  95. *
  96. * @see \Drupal\Core\Config\ConfigImporterEvent
  97. * @see \Drupal\Core\Config\ConfigImporter::import().
  98. * @see \Drupal\Core\EventSubscriber\ConfigSnapshotSubscriber::onConfigImporterImport().
  99. *
  100. * @var string
  101. */
  102. const IMPORT = 'config.importer.import';
  103. /**
  104. * Name of event fired when missing content dependencies are detected.
  105. *
  106. * Events subscribers are fired as part of the configuration import batch.
  107. * Each subscribe should call
  108. * \Drupal\Core\Config\MissingContentEvent::resolveMissingContent() when they
  109. * address a missing dependency. To address large amounts of dependencies
  110. * subscribers can call
  111. * \Drupal\Core\Config\MissingContentEvent::stopPropagation() which will stop
  112. * calling other events and guarantee that the configuration import batch will
  113. * fire the event again to continue processing missing content dependencies.
  114. *
  115. * @see \Drupal\Core\Config\ConfigImporter::processMissingContent()
  116. * @see \Drupal\Core\Config\MissingContentEvent
  117. */
  118. const IMPORT_MISSING_CONTENT = 'config.importer.missing_content';
  119. /**
  120. * Name of event fired to collect information on all config collections.
  121. *
  122. * This event allows modules to add to the list of configuration collections
  123. * retrieved by \Drupal\Core\Config\ConfigManager::getConfigCollectionInfo().
  124. * The event listener method receives a
  125. * \Drupal\Core\Config\ConfigCollectionInfo instance.
  126. *
  127. * @Event
  128. *
  129. * @see \Drupal\Core\Config\ConfigCollectionInfo
  130. * @see \Drupal\Core\Config\ConfigManager::getConfigCollectionInfo()
  131. * @see \Drupal\Core\Config\ConfigFactoryOverrideBase
  132. *
  133. * @var string
  134. */
  135. const COLLECTION_INFO = 'config.collection_info';
  136. }