public function EventMeta::removeGroup in RNG - Events and Registrations 8.2
Same name and namespace in other branches
- 8 src/EventMeta.php \Drupal\rng\EventMeta::removeGroup()
- 3.x src/EventMeta.php \Drupal\rng\EventMeta::removeGroup()
Removes references to a default group from the event.
Parameters
int $group_id: The ID of a registration_group entity.
Return value
\Drupal\Core\Entity\EntityInterface The modified event.
Overrides EventMetaInterface::removeGroup
File
- src/
EventMeta.php, line 212
Class
- EventMeta
- Meta event wrapper for RNG.
Namespace
Drupal\rngCode
public function removeGroup($group_id) {
/** @var \Drupal\Core\Field\FieldItemListInterface $groups */
$groups =& $this->entity->{EventManagerInterface::FIELD_REGISTRATION_GROUPS};
foreach ($groups
->getValue() as $key => $value) {
if ($value['target_id'] == $group_id) {
$groups
->removeItem($key);
}
}
return $this->entity;
}