public function RefinableCalculatedGroupPermissions::addItem in Group 8
Same name and namespace in other branches
- 2.0.x src/Access/RefinableCalculatedGroupPermissions.php \Drupal\group\Access\RefinableCalculatedGroupPermissions::addItem()
Adds a calculated permission item.
Parameters
\Drupal\group\Access\CalculatedGroupPermissionsItemInterface $item: The calculated permission item.
bool $overwrite: (optional) Whether to overwrite an item if there already is one for the given identifier within the scope. Defaults to FALSE, meaning a merge will take place instead.
Return value
$this
Overrides RefinableCalculatedGroupPermissionsInterface::addItem
1 call to RefinableCalculatedGroupPermissions::addItem()
- RefinableCalculatedGroupPermissions::merge in src/
Access/ RefinableCalculatedGroupPermissions.php - Merge another calculated group permissions object into this one.
File
- src/
Access/ RefinableCalculatedGroupPermissions.php, line 20
Class
- RefinableCalculatedGroupPermissions
- Represents a calculated set of group permissions with cacheable metadata.
Namespace
Drupal\group\AccessCode
public function addItem(CalculatedGroupPermissionsItemInterface $item, $overwrite = FALSE) {
if (!$overwrite && ($existing = $this
->getItem($item
->getScope(), $item
->getIdentifier()))) {
$item = $this
->mergeItems($existing, $item);
}
$this->items[$item
->getScope()][$item
->getIdentifier()] = $item;
return $this;
}