protected function ConfigSnapshot::getItemKey in Config Snapshot 8
Returns the key of a given item.
Return value
int|false The key of the item or FALSE if not found.
3 calls to ConfigSnapshot::getItemKey()
- ConfigSnapshot::clearItem in src/
Entity/ ConfigSnapshot.php - Clears an item from the snapshot for a given collection.
- ConfigSnapshot::getItem in src/
Entity/ ConfigSnapshot.php - Returns an item from the snapshot for a given collection.
- ConfigSnapshot::setItem in src/
Entity/ ConfigSnapshot.php - Returns an item from the snapshot for a given collection.
File
- src/
Entity/ ConfigSnapshot.php, line 176
Class
- ConfigSnapshot
- Defines the Config snapshot entity.
Namespace
Drupal\config_snapshot\EntityCode
protected function getItemKey($collection, $name) {
$items = array_filter($this->items, function ($item) use ($collection, $name) {
return $item['collection'] === $collection && $item['name'] === $name;
});
if ($items) {
return key($items);
}
return FALSE;
}