ConfigManager
class ConfigManager implements ConfigManagerInterface (View source)
The ConfigManager provides helper functions for the configuration system.
Traits
Wrapper methods for \Drupal\Core\StringTranslation\TranslationInterface.
Utility trait to copy configuration from one storage to another.
Properties
| protected TranslationInterface | $stringTranslation | The string translation service. |
from StringTranslationTrait |
| protected EntityTypeManagerInterface | $entityTypeManager | The entity type manager. |
|
| protected EntityRepositoryInterface | $entityRepository | The entity repository. |
|
| protected ConfigFactoryInterface | $configFactory | The configuration factory. |
|
| protected TypedConfigManagerInterface | $typedConfigManager | The typed config manager. |
|
| protected StorageInterface | $activeStorage | The active configuration storage. |
|
| protected EventDispatcherInterface | $eventDispatcher | The event dispatcher. |
|
| protected ConfigCollectionInfo | $configCollectionInfo | The configuration collection info. |
|
| protected StorageInterface[] | $storages | The configuration storages keyed by collection name. |
|
| protected ExtensionPathResolver | $extensionPathResolver | The extension path resolver. |
Methods
Translates a string to the current language or to a given language.
Formats a string containing a count of items.
Returns the number of plurals supported by a given language.
Gets the string translation service.
Copy the configuration from one storage to another and remove stale items.
Creates ConfigManager objects.
Returns the entity type of a configuration object.
Loads a configuration entity using the configuration name.
Gets the entity type manager.
Gets the config factory.
Creates a Diff object using the config data from the two storages.
Creates a configuration snapshot following a successful import.
Uninstalls the configuration of a given extension.
Creates and populates a ConfigDependencyManager object.
Finds config entities that are dependent on extensions or entities.
Finds config entities that are dependent on extensions or entities.
Deprecated method to find config entity dependencies.
Deprecated method to find config entity dependencies as entities.
Lists which config entities to update and delete on removal of a dependency.
Gets available collection information using the event system.
Calls an entity's onDependencyRemoval() method.
Finds missing content dependencies declared in configuration entities.
Details
protected TranslatableMarkup
t(string $string, array $args = [], array $options = [])
Translates a string to the current language or to a given language.
See \Drupal\Core\StringTranslation\TranslatableMarkup::__construct() for important security information and usage guidelines.
In order for strings to be localized, make them available in one of the ways supported by the
protected
formatPlural($count, $singular, $plural, array $args = [], array $options = [])
Formats a string containing a count of items.
protected
getNumberOfPlurals($langcode = NULL)
Returns the number of plurals supported by a given language.
protected TranslationInterface
getStringTranslation()
Gets the string translation service.
$this
setStringTranslation(TranslationInterface $translation)
Sets the string translation service to use.
static protected
replaceStorageContents(StorageInterface $source, StorageInterface $target)
Copy the configuration from one storage to another and remove stale items.
This method empties target storage and copies all collections from source. Configuration is only copied and not imported, should not be used with the active storage as the target.
__construct(EntityTypeManagerInterface $entity_type_manager, ConfigFactoryInterface $config_factory, TypedConfigManagerInterface $typed_config_manager, TranslationInterface $string_translation, StorageInterface $active_storage, EventDispatcherInterface $event_dispatcher, EntityRepositoryInterface $entity_repository, ExtensionPathResolver $extension_path_resolver = NULL)
Creates ConfigManager objects.
string|null
getEntityTypeIdByName(string $name)
Returns the entity type of a configuration object.
EntityInterface|null
loadConfigEntityByName(string $name)
Loads a configuration entity using the configuration name.
EntityTypeManagerInterface
getEntityTypeManager()
Gets the entity type manager.
ConfigFactoryInterface
getConfigFactory()
Gets the config factory.
Diff
diff(StorageInterface $source_storage, StorageInterface $target_storage, string $source_name, string $target_name = NULL, string $collection = StorageInterface::DEFAULT_COLLECTION)
Creates a Diff object using the config data from the two storages.
createSnapshot(StorageInterface $source_storage, StorageInterface $snapshot_storage)
Creates a configuration snapshot following a successful import.
uninstall(string $type, string $name)
Uninstalls the configuration of a given extension.
ConfigDependencyManager
getConfigDependencyManager()
Creates and populates a ConfigDependencyManager object.
The configuration dependency manager is populated with data from the active store.
ConfigEntityDependency[]
findConfigEntityDependencies(string $type, array $names, ConfigDependencyManager $dependency_manager = NULL)
Finds config entities that are dependent on extensions or entities.
ConfigEntityInterface[]
findConfigEntityDependenciesAsEntities(string $type, array $names, ConfigDependencyManager $dependency_manager = NULL)
Finds config entities that are dependent on extensions or entities.
ConfigEntityDependency[]
findConfigEntityDependents(string $type, array $names, ConfigDependencyManager $dependency_manager = NULL)
Deprecated method to find config entity dependencies.
ConfigEntityInterface[]
findConfigEntityDependentsAsEntities(string $type, array $names, ConfigDependencyManager $dependency_manager = NULL)
Deprecated method to find config entity dependencies as entities.
array
getConfigEntitiesToChangeOnDependencyRemoval(string $type, array $names, bool $dry_run = TRUE)
Lists which config entities to update and delete on removal of a dependency.
ConfigCollectionInfo
getConfigCollectionInfo()
Gets available collection information using the event system.
protected bool
callOnDependencyRemoval(ConfigEntityInterface $entity, array $dependent_entities, string $type, array $names)
Calls an entity's onDependencyRemoval() method.
A helper method to call onDependencyRemoval() with the correct list of affected entities. This list should only contain dependencies on the entity. Configuration and content entity dependencies will be converted into entity objects.
array
findMissingContentDependencies()
Finds missing content dependencies declared in configuration entities.