You are here

public function SavedSearchType::addNotificationPlugin in Search API Saved Searches 8

Adds a notification plugin to this saved search type.

An existing notification plugin with the same ID will be replaced.

Parameters

\Drupal\search_api_saved_searches\Notification\NotificationPluginInterface $notification_plugin: The notification plugin to be added.

Return value

$this

Overrides SavedSearchTypeInterface::addNotificationPlugin

File

src/Entity/SavedSearchType.php, line 363

Class

SavedSearchType
Provides an entity type for configuring how searches can be saved.

Namespace

Drupal\search_api_saved_searches\Entity

Code

public function addNotificationPlugin(NotificationPluginInterface $notification_plugin) {

  // Make sure the notificationPluginInstances are loaded before trying to add
  // a plugin to them.
  if ($this->notificationPluginInstances === NULL) {
    $this
      ->getNotificationPlugins();
  }
  $this->notificationPluginInstances[$notification_plugin
    ->getPluginId()] = $notification_plugin;
  return $this;
}