ConfigManagerInterface.php 6.5 KB

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