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