SourceStorage.php in Configuration installer 8
File
src/Storage/SourceStorage.php
View source
<?php
namespace Drupal\config_installer\Storage;
use Drupal\Core\Config\StorageInterface;
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
class SourceStorage implements StorageInterface {
use DependencySerializationTrait;
protected $baseStorage;
protected $profiles;
public function __construct(StorageInterface $base_storage, array $profiles) {
$this->baseStorage = $base_storage;
$this->profiles = $profiles;
}
public function exists($name) {
return $this->baseStorage
->exists($name);
}
public function read($name) {
$data = $this->baseStorage
->read($name);
if ($name === 'core.extension' && isset($data['module'])) {
$data['module'] = array_diff_key($data['module'], $this->profiles);
}
return $data;
}
public function readMultiple(array $names) {
$list = [];
foreach ($names as $name) {
if ($data = $this
->read($name)) {
$list[$name] = $data;
}
}
return $list;
}
public function write($name, array $data) {
return $this->baseStorage
->write($name, $data);
}
public function delete($name) {
return $this->baseStorage
->delete($name);
}
public function rename($name, $new_name) {
return $this->baseStorage
->rename($name, $new_name);
}
public function encode($data) {
return $this->baseStorage
->encode($data);
}
public function decode($raw) {
return $this->baseStorage
->decode($raw);
}
public function listAll($prefix = '') {
return $this->baseStorage
->listAll($prefix);
}
public function deleteAll($prefix = '') {
return $this->baseStorage
->deleteAll($prefix);
}
public function createCollection($collection) {
return new static($this->baseStorage
->createCollection($collection), $this->profiles);
}
public function getAllCollectionNames() {
return $this->baseStorage
->getAllCollectionNames();
}
public function getCollectionName() {
return $this->baseStorage
->getCollectionName();
}
}
Classes
Name |
Description |
SourceStorage |
Wraps the sync storage so the config_installer can make modifications. |