ConfigEvents.php 4.75 KB
Newer Older
1 2 3 4 5 6
<?php

namespace Drupal\Core\Config;

/**
 * Defines events for the configuration system.
7 8
 *
 * @see \Drupal\Core\Config\ConfigCrudEvent
9
 */
10
final class ConfigEvents {
11 12

  /**
13
   * Name of the event fired when saving a configuration object.
14
   *
15 16 17 18
   * This event allows modules to perform an action whenever a configuration
   * object is saved. The event listener method receives a
   * \Drupal\Core\Config\ConfigCrudEvent instance.
   *
19 20 21 22
   * See hook_update_N() documentation for safe configuration API usage and
   * restrictions as this event will be fired when configuration is saved by
   * hook_update_N().
   *
23 24 25
   * @Event
   *
   * @see \Drupal\Core\Config\ConfigCrudEvent
26 27
   * @see \Drupal\Core\Config\Config::save()
   * @see \Drupal\Core\Config\ConfigFactory::onConfigSave()
28
   * @see hook_update_N()
29 30
   *
   * @var string
31 32 33 34
   */
  const SAVE = 'config.save';

  /**
35 36 37 38 39 40
   * Name of the event fired when deleting a configuration object.
   *
   * This event allows modules to perform an action whenever a configuration
   * object is deleted. The event listener method receives a
   * \Drupal\Core\Config\ConfigCrudEvent instance.
   *
41 42 43 44
   * See hook_update_N() documentation for safe configuration API usage and
   * restrictions as this event will be fired when configuration is deleted by
   * hook_update_N().
   *
45
   * @Event
46
   *
47
   * @see \Drupal\Core\Config\ConfigCrudEvent
48
   * @see \Drupal\Core\Config\Config::delete()
49
   * @see \Drupal\Core\Config\ConfigFactory::onConfigDelete()
50
   * @see hook_update_N()
51 52
   *
   * @var string
53 54 55 56
   */
  const DELETE = 'config.delete';

  /**
57 58 59 60 61 62
   * Name of the event fired when renaming a configuration object.
   *
   * This event allows modules to perform an action whenever a configuration
   * object's name is changed. The event listener method receives a
   * \Drupal\Core\Config\ConfigRenameEvent instance.
   *
63 64 65 66
   * See hook_update_N() documentation for safe configuration API usage and
   * restrictions as this event will be fired when configuration is renamed by
   * hook_update_N().
   *
67
   * @Event
68
   *
69
   * @see \Drupal\Core\Config\ConfigRenameEvent
70 71
   * @see \Drupal\Core\Config\ConfigFactoryInterface::rename()
   * @see hook_update_N()
72 73
   *
   * @var string
74 75 76 77
   */
  const RENAME = 'config.rename';

  /**
78 79 80 81 82
   * Name of the event fired when validating imported configuration.
   *
   * This event allows modules to perform additional validation operations when
   * configuration is being imported. The event listener method receives a
   * \Drupal\Core\Config\ConfigImporterEvent instance.
83
   *
84 85 86
   * @Event
   *
   * @see \Drupal\Core\Config\ConfigImporterEvent
87 88
   * @see \Drupal\Core\Config\ConfigImporter::validate().
   * @see \Drupal\Core\EventSubscriber\ConfigImportSubscriber::onConfigImporterValidate().
89 90
   *
   * @var string
91
   */
92
  const IMPORT_VALIDATE = 'config.importer.validate';
93 94

  /**
95 96 97 98 99
   * Name of the event fired when importing configuration to target storage.
   *
   * This event allows modules to perform additional actions when configuration
   * is imported. The event listener method receives a
   * \Drupal\Core\Config\ConfigImporterEvent instance.
100
   *
101 102 103
   * @Event
   *
   * @see \Drupal\Core\Config\ConfigImporterEvent
104 105
   * @see \Drupal\Core\Config\ConfigImporter::import().
   * @see \Drupal\Core\EventSubscriber\ConfigSnapshotSubscriber::onConfigImporterImport().
106 107
   *
   * @var string
108 109 110
   */
  const IMPORT = 'config.importer.import';

111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
  /**
   * Name of event fired when missing content dependencies are detected.
   *
   * Events subscribers are fired as part of the configuration import batch.
   * Each subscribe should call
   * \Drupal\Core\Config\MissingContentEvent::resolveMissingContent() when they
   * address a missing dependency. To address large amounts of dependencies
   * subscribers can call
   * \Drupal\Core\Config\MissingContentEvent::stopPropagation() which will stop
   * calling other events and guarantee that the configuration import batch will
   * fire the event again to continue processing missing content dependencies.
   *
   * @see \Drupal\Core\Config\ConfigImporter::processMissingContent()
   * @see \Drupal\Core\Config\MissingContentEvent
   */
  const IMPORT_MISSING_CONTENT = 'config.importer.missing_content';

128
  /**
129 130 131 132 133 134 135 136
   * Name of event fired to collect information on all config collections.
   *
   * This event allows modules to add to the list of configuration collections
   * retrieved by \Drupal\Core\Config\ConfigManager::getConfigCollectionInfo().
   * The event listener method receives a
   * \Drupal\Core\Config\ConfigCollectionInfo instance.
   *
   * @Event
137
   *
138
   * @see \Drupal\Core\Config\ConfigCollectionInfo
139 140 141 142
   * @see \Drupal\Core\Config\ConfigManager::getConfigCollectionInfo()
   * @see \Drupal\Core\Config\ConfigFactoryOverrideBase
   *
   * @var string
143
   */
144
  const COLLECTION_INFO = 'config.collection_info';
145

146
}