public function ConfigurableTrait::setConfig in Backup and Migrate 5.0.x
Set the configuration for all plugins.
Parameters
ConfigInterface $config: A configuration object containing only configuration for all plugins.
1 call to ConfigurableTrait::setConfig()
- ConfigurableTrait::__construct in src/
Core/ Config/ ConfigurableTrait.php
1 method overrides ConfigurableTrait::setConfig()
- PluginManager::setConfig in src/
Core/ Plugin/ PluginManager.php - Set the configuration. Reconfigure all of the installed plugins.
File
- src/
Core/ Config/ ConfigurableTrait.php, line 55
Class
- ConfigurableTrait
- A configurable object. Manages injection and access to a config object.
Namespace
Drupal\backup_migrate\Core\ConfigCode
public function setConfig(ConfigInterface $config) {
// Set the configuration object to the one passed in.
$this->config = $config;
// Add the init/default values to the config object so they will always
// exist.
// @todo Make this cascade happen when the config key is requested.
// That will allow read-only or runtime generation config object to be
// passed. This would work by creating a CascadeConfig object which takes
// an array of ConfigInterface objects and queries each in order to find
// the given key.
$defaults = $this
->configDefaults();
$init = $this->init;
foreach ([
$init,
$defaults,
] as $config_object) {
foreach ($config_object
->toArray() as $key => $value) {
if (!$this->config
->keyIsSet($key)) {
$this->config
->set($key, $value);
}
}
}
}