public function ConfigSnapshot::setItem in Config Snapshot 8
Returns an item from the snapshot for a given collection.
Parameters
string $collection: The configuration collection.
string $name: The name of a configuration object.
array $data: Data to set for the configuration object.
Return value
\Drupal\config_snapshot\Entity\ConfigSnapshotInterface A config snapshot object for chaining.
Overrides ConfigSnapshotInterface::setItem
File
- src/
Entity/ ConfigSnapshot.php, line 131
Class
- ConfigSnapshot
- Defines the Config snapshot entity.
Namespace
Drupal\config_snapshot\EntityCode
public function setItem($collection, $name, array $data) {
$item = [
'collection' => $collection,
'name' => $name,
'data' => $data,
];
if (($key = $this
->getItemKey($collection, $name)) !== FALSE) {
$this->items[$key] = $item;
}
else {
$this->items[] = $item;
}
return $this;
}