ConfigFactoryOverrideInterface.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. namespace Drupal\Core\Config;
  3. /**
  4. * Defines the interface for a configuration factory override object.
  5. */
  6. interface ConfigFactoryOverrideInterface {
  7. /**
  8. * Returns config overrides.
  9. *
  10. * @param array $names
  11. * A list of configuration names that are being loaded.
  12. *
  13. * @return array
  14. * An array keyed by configuration name of override data. Override data
  15. * contains a nested array structure of overrides.
  16. */
  17. public function loadOverrides($names);
  18. /**
  19. * The string to append to the configuration static cache name.
  20. *
  21. * @return string
  22. * A string to append to the configuration static cache name.
  23. */
  24. public function getCacheSuffix();
  25. /**
  26. * Creates a configuration object for use during install and synchronization.
  27. *
  28. * If the overrider stores its overrides in configuration collections then
  29. * it can have its own implementation of
  30. * \Drupal\Core\Config\StorableConfigBase. Configuration overriders can link
  31. * themselves to a configuration collection by listening to the
  32. * \Drupal\Core\Config\ConfigEvents::COLLECTION_INFO event and adding the
  33. * collections they are responsible for. Doing this will allow installation
  34. * and synchronization to use the overrider's implementation of
  35. * StorableConfigBase.
  36. *
  37. * @see \Drupal\Core\Config\ConfigCollectionInfo
  38. * @see \Drupal\Core\Config\ConfigImporter::importConfig()
  39. * @see \Drupal\Core\Config\ConfigInstaller::createConfiguration()
  40. *
  41. * @param string $name
  42. * The configuration object name.
  43. * @param string $collection
  44. * The configuration collection.
  45. *
  46. * @return \Drupal\Core\Config\StorableConfigBase
  47. * The configuration object for the provided name and collection.
  48. */
  49. public function createConfigObject($name, $collection = StorageInterface::DEFAULT_COLLECTION);
  50. /**
  51. * Gets the cacheability metadata associated with the config factory override.
  52. *
  53. * @param string $name
  54. * The name of the configuration override to get metadata for.
  55. *
  56. * @return \Drupal\Core\Cache\CacheableMetadata
  57. * A cacheable metadata object.
  58. */
  59. public function getCacheableMetadata($name);
  60. }