class ConfigSnapshotServiceProvider in Config Snapshot 8
Registers one service per config snapshot.
Hierarchy
- class \Drupal\Core\DependencyInjection\ServiceProviderBase implements ServiceModifierInterface, ServiceProviderInterface
- class \Drupal\config_snapshot\ConfigSnapshotServiceProvider
Expanded class hierarchy of ConfigSnapshotServiceProvider
File
- src/
ConfigSnapshotServiceProvider.php, line 12
Namespace
Drupal\config_snapshotView source
class ConfigSnapshotServiceProvider extends ServiceProviderBase {
const CONFIG_PREFIX = 'config_snapshot.snapshot.';
/**
* {@inheritdoc}
*/
public function register(ContainerBuilder $container) {
// @see Drupal\language\LanguageServiceProvider::isMultilingual()
// @todo Try to swap out for config.storage to take advantage of database
// and caching. This might prove difficult as this is called before the
// container has finished building.
$config_storage = BootstrapConfigStorageFactory::get();
$config_ids = $config_storage
->listAll(static::CONFIG_PREFIX);
foreach ($config_ids as $config_id) {
$snapshot = $config_storage
->read($config_id);
$container
->register("config_snapshot.{$snapshot['snapshotSet']}.{$snapshot['extensionType']}.{$snapshot['extensionName']}", 'Drupal\\config_snapshot\\ConfigSnapshotStorage')
->addArgument($snapshot['snapshotSet'])
->addArgument($snapshot['extensionType'])
->addArgument($snapshot['extensionName']);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigSnapshotServiceProvider:: |
constant | |||
ConfigSnapshotServiceProvider:: |
public | function |
Registers services to the container. Overrides ServiceProviderBase:: |
|
ServiceProviderBase:: |
public | function |
Modifies existing service definitions. Overrides ServiceModifierInterface:: |
5 |