ConfigImporterEvent.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace Drupal\Core\Config;
  3. use Symfony\Component\EventDispatcher\Event;
  4. class ConfigImporterEvent extends Event {
  5. /**
  6. * Configuration import object.
  7. *
  8. * @var \Drupal\Core\Config\ConfigImporter
  9. */
  10. protected $configImporter;
  11. /**
  12. * Constructs ConfigImporterEvent.
  13. *
  14. * @param \Drupal\Core\Config\ConfigImporter $config_importer
  15. * A config import object to notify listeners about.
  16. */
  17. public function __construct(ConfigImporter $config_importer) {
  18. $this->configImporter = $config_importer;
  19. }
  20. /**
  21. * Gets the config import object.
  22. *
  23. * @return \Drupal\Core\Config\ConfigImporter
  24. * The ConfigImporter object.
  25. */
  26. public function getConfigImporter() {
  27. return $this->configImporter;
  28. }
  29. /**
  30. * Gets the list of changes that will be imported.
  31. *
  32. * @param string $op
  33. * (optional) A change operation. Either delete, create or update. If
  34. * supplied the returned list will be limited to this operation.
  35. * @param string $collection
  36. * (optional) The collection to get the changelist for. Defaults to the
  37. * default collection.
  38. *
  39. * @return array
  40. * An array of config changes that are yet to be imported.
  41. *
  42. * @see \Drupal\Core\Config\StorageComparerInterface::getChangelist()
  43. */
  44. public function getChangelist($op = NULL, $collection = StorageInterface::DEFAULT_COLLECTION) {
  45. return $this->configImporter->getStorageComparer()->getChangelist($op, $collection);
  46. }
  47. }