You are here

public function FlagSearchApiSubscriber::flagEntityUnflagged in Flag Search API 8

Method is called whenever the flag.entity_unflagged event is dispatched.

Parameters

\Drupal\flag\Event\UnflaggingEvent $event: Event.

File

src/EventSubscriber/FlagSearchApiSubscriber.php, line 58

Class

FlagSearchApiSubscriber
Class FlagSearchApiSubscriber.

Namespace

Drupal\flag_search_api\EventSubscriber

Code

public function flagEntityUnflagged(UnflaggingEvent $event) {
  $flaggings = $event
    ->getFlaggings();

  /** @var \Drupal\flag\FlaggingInterface $flagging */
  foreach ($flaggings as $flagging) {
    $this->flagSearchApiReindex
      ->reindexItem($flagging);
  }
}