You are here

public function Email::notify in Search API Saved Searches 8

Notifies the search's owner of new results.

Parameters

\Drupal\search_api_saved_searches\SavedSearchInterface $search: The saved search for which to report new results.

\Drupal\search_api\Query\ResultSetInterface $results: The new results.

Overrides NotificationPluginInterface::notify

File

src/Plugin/search_api_saved_searches/notification/Email.php, line 394

Class

Email
Provides e-mails as a notification mechanism.

Namespace

Drupal\search_api_saved_searches\Plugin\search_api_saved_searches\notification

Code

public function notify(SavedSearchInterface $search, ResultSetInterface $results) {
  $params = [
    'search' => $search,
    'results' => $results,
    'plugin' => $this,
  ];
  $this
    ->getMailService()
    ->mail('search_api_saved_searches', self::MAIL_NEW_RESULTS, $search
    ->get('mail')->value, $this
    ->getPreferredLangcode($search), $params);
}