public function FlagForListSubscriber::flagListsEntityUnflagged in Flag Lists 4.0.x
Same name and namespace in other branches
- 8 src/EventSubscriber/FlagForListSubscriber.php \Drupal\flag_lists\EventSubscriber\FlagForListSubscriber::flagListsEntityUnflagged()
This is called whenever the flag.entity_unflagged event is dispatched.
Parameters
Symfony\Component\EventDispatcher\Event $flag_events: The response events.
File
- src/
EventSubscriber/ FlagForListSubscriber.php, line 57
Class
- FlagForListSubscriber
- Subscribe to Flag events.
Namespace
Drupal\flag_lists\EventSubscriberCode
public function flagListsEntityUnflagged(Event $flag_events) {
foreach ($flag_events
->getFlaggings() as $flagging) {
$flagId = $flagging
->getFlagId();
foreach (\Drupal::service('flaglists')
->getAllFlagForList() as $collection) {
if ($collection
->getBaseFlag() == $flagId) {
$this
->messenger()
->addMessage(t('Entity removed from the %flaglist list.', [
'%flaglist' => $flagId,
]));
}
}
}
}