Skip to content
Snippets Groups Projects
Commit bcf655e8 authored by dpi's avatar dpi
Browse files

Added saved message to message list.

Changed parameters of Registration::removeGroup() in line with EventMeta::removeGroup()
parent 2123c5e4
No related branches found
No related tags found
No related merge requests found
......@@ -191,7 +191,7 @@ class Group extends ContentEntityBase implements GroupInterface {
// Remove entity field references from registrations to group.
foreach ($event_meta->getRegistrations() as $registration) {
$registration
->removeGroup($group)
->removeGroup($group->id())
->save();
}
}
......
......@@ -177,9 +177,11 @@ class Registration extends ContentEntityBase implements RegistrationInterface {
/**
* {@inheritdoc}
*/
public function removeGroup(GroupInterface $group) {
if (($key = array_search($group, $this->getGroups())) !== FALSE) {
$this->groups->removeItem($key);
public function removeGroup($group_id) {
foreach ($this->groups->getValue() as $key => $value) {
if ($value['target_id'] == $group_id) {
$this->groups->removeItem($key);
}
}
return $this;
}
......
......@@ -189,6 +189,8 @@ class MessageListForm extends FormBase {
->save();
}
}
drupal_set_message($this->t('Messages saved.'));
}
}
......@@ -111,12 +111,12 @@ interface RegistrationInterface extends ContentEntityInterface, EntityChangedInt
/**
* Remove a group from the registration.
*
* @param \Drupal\rng\GroupInterface $group
* The group to remove.
* @param int $group_id
* The ID of a rng_group entity.
*
* @return \Drupal\rng\RegistrationInterface
* Returns registration for chaining.
*/
public function removeGroup(GroupInterface $group);
public function removeGroup($group_id);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment