ConfigManagerInterface.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <?php
  2. namespace Drupal\Core\Config;
  3. /**
  4. * Provides an interface for configuration manager.
  5. */
  6. interface ConfigManagerInterface {
  7. /**
  8. * Returns the entity type of a configuration object.
  9. *
  10. * @param string $name
  11. * The configuration object name.
  12. *
  13. * @return string|null
  14. * Either the entity type name, or NULL if none match.
  15. */
  16. public function getEntityTypeIdByName($name);
  17. /**
  18. * Loads a configuration entity using the configuration name.
  19. *
  20. * @param string $name
  21. * The configuration object name.
  22. *
  23. * @return \Drupal\Core\Entity\EntityInterface|null
  24. * The configuration entity or NULL if it does not exist.
  25. */
  26. public function loadConfigEntityByName($name);
  27. /**
  28. * Gets the entity manager.
  29. *
  30. * @return \Drupal\Core\Entity\EntityManagerInterface
  31. * The entity manager.
  32. */
  33. public function getEntityManager();
  34. /**
  35. * Gets the config factory.
  36. *
  37. * @return \Drupal\Core\Config\ConfigFactoryInterface
  38. * The entity manager.
  39. */
  40. public function getConfigFactory();
  41. /**
  42. * Creates a Diff object using the config data from the two storages.
  43. *
  44. * @param \Drupal\Core\Config\StorageInterface $source_storage
  45. * The storage to diff configuration from.
  46. * @param \Drupal\Core\Config\StorageInterface $target_storage
  47. * The storage to diff configuration to.
  48. * @param string $source_name
  49. * The name of the configuration object in the source storage to diff.
  50. * @param string $target_name
  51. * (optional) The name of the configuration object in the target storage.
  52. * If omitted, the source name is used.
  53. * @param string $collection
  54. * (optional) The configuration collection name. Defaults to the default
  55. * collection.
  56. *
  57. * @return \Drupal\Component\Diff\Diff
  58. * A Diff object using the config data from the two storages.
  59. *
  60. * @todo Make renderer injectable
  61. *
  62. * @see \Drupal\Core\Diff\DiffFormatter
  63. */
  64. public function diff(StorageInterface $source_storage, StorageInterface $target_storage, $source_name, $target_name = NULL, $collection = StorageInterface::DEFAULT_COLLECTION);
  65. /**
  66. * Creates a configuration snapshot following a successful import.
  67. *
  68. * @param \Drupal\Core\Config\StorageInterface $source_storage
  69. * The storage to synchronize configuration from.
  70. * @param \Drupal\Core\Config\StorageInterface $snapshot_storage
  71. * The storage to synchronize configuration to.
  72. */
  73. public function createSnapshot(StorageInterface $source_storage, StorageInterface $snapshot_storage);
  74. /**
  75. * Uninstalls the configuration of a given extension.
  76. *
  77. * @param string $type
  78. * The extension type; e.g., 'module' or 'theme'.
  79. * @param string $name
  80. * The name of the module or theme to install configuration for.
  81. */
  82. public function uninstall($type, $name);
  83. /**
  84. * Creates and populates a ConfigDependencyManager object.
  85. *
  86. * The configuration dependency manager is populated with data from the active
  87. * store.
  88. *
  89. * @return \Drupal\Core\Config\Entity\ConfigDependencyManager
  90. */
  91. public function getConfigDependencyManager();
  92. /**
  93. * Finds config entities that are dependent on extensions or entities.
  94. *
  95. * @param string $type
  96. * The type of dependency being checked. Either 'module', 'theme', 'config'
  97. * or 'content'.
  98. * @param array $names
  99. * The specific names to check. If $type equals 'module' or 'theme' then it
  100. * should be a list of module names or theme names. In the case of 'config'
  101. * or 'content' it should be a list of configuration dependency names.
  102. *
  103. * @return \Drupal\Core\Config\Entity\ConfigEntityDependency[]
  104. * An array of configuration entity dependency objects.
  105. */
  106. public function findConfigEntityDependents($type, array $names);
  107. /**
  108. * Finds config entities that are dependent on extensions or entities.
  109. *
  110. * @param string $type
  111. * The type of dependency being checked. Either 'module', 'theme', 'config'
  112. * or 'content'.
  113. * @param array $names
  114. * The specific names to check. If $type equals 'module' or 'theme' then it
  115. * should be a list of module names or theme names. In the case of 'config'
  116. * or 'content' it should be a list of configuration dependency names.
  117. *
  118. * @return \Drupal\Core\Config\Entity\ConfigEntityInterface[]
  119. * An array of dependencies as configuration entities.
  120. */
  121. public function findConfigEntityDependentsAsEntities($type, array $names);
  122. /**
  123. * Lists which config entities to update and delete on removal of a dependency.
  124. *
  125. * @param string $type
  126. * The type of dependency being checked. Either 'module', 'theme', 'config'
  127. * or 'content'.
  128. * @param array $names
  129. * The specific names to check. If $type equals 'module' or 'theme' then it
  130. * should be a list of module names or theme names. In the case of 'config'
  131. * or 'content' it should be a list of configuration dependency names.
  132. * @param bool $dry_run
  133. * If set to FALSE the entities returned in the list of updates will be
  134. * modified. In order to make the changes the caller needs to save them. If
  135. * set to TRUE the entities returned will not be modified.
  136. *
  137. * @return array
  138. * An array with the keys: 'update', 'delete' and 'unchanged'. The value of
  139. * each is a list of configuration entities that need to have that action
  140. * applied when the supplied dependencies are removed. Updates need to be
  141. * processed before deletes. The order of the deletes is significant and
  142. * must be processed in the returned order.
  143. */
  144. public function getConfigEntitiesToChangeOnDependencyRemoval($type, array $names, $dry_run = TRUE);
  145. /**
  146. * Gets available collection information using the event system.
  147. *
  148. * @return \Drupal\Core\Config\ConfigCollectionInfo
  149. * The object which contains information about the available collections.
  150. */
  151. public function getConfigCollectionInfo();
  152. /**
  153. * Finds missing content dependencies declared in configuration entities.
  154. *
  155. * @return array
  156. * A list of missing content dependencies. The array is keyed by UUID. Each
  157. * value is an array with the following keys: 'entity_type', 'bundle' and
  158. * 'uuid'.
  159. */
  160. public function findMissingContentDependencies();
  161. }