Foo.php in Configuration Provider 8.2
File
tests/modules/config_provider_multi_providers_test/src/Plugin/ConfigProvider/Foo.php
View source
<?php
namespace Drupal\config_provider_foo_provider_test\Plugin\ConfigProvider;
use Drupal\config_provider\Plugin\ConfigProviderBase;
use Drupal\Core\Config\StorageInterface;
class Foo extends ConfigProviderBase {
const ID = 'config/foo';
public function addConfigToCreate(array &$config_to_create, StorageInterface $storage, $collection, $prefix = '', array $profile_storages = []) {
$foo_config_to_create = $this
->getFooConfig();
$config_to_create = array_merge($foo_config_to_create, $config_to_create);
}
public function addInstallableConfig(array $extensions = []) {
foreach ($this
->getFooConfig($extensions) as $name => $value) {
$this->providerStorage
->write($name, $value);
}
}
private function getFooConfig(array $extensions = []) : array {
$storage = $this
->getExtensionInstallStorage(static::ID);
$config_names = $this
->listConfig($storage, $extensions);
return $storage
->readMultiple($config_names);
}
}
Classes
Name |
Description |
Foo |
Class for providing configuration from an 'foo' directory. |