You are here

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

Retrieves a specific notification plugin for this saved search type.

Parameters

string $notification_plugin_id: The ID of the notification plugin to return.

Return value

\Drupal\search_api_saved_searches\Notification\NotificationPluginInterface The notification plugin with the given ID.

Throws

\Drupal\search_api_saved_searches\SavedSearchesException Thrown if the specified notification plugin isn't enabled for this saved search type, or couldn't be loaded.

Overrides SavedSearchTypeInterface::getNotificationPlugin

File

src/Entity/SavedSearchType.php, line 349

Class

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

Namespace

Drupal\search_api_saved_searches\Entity

Code

public function getNotificationPlugin($notification_plugin_id) {
  $notification_plugins = $this
    ->getNotificationPlugins();
  if (empty($notification_plugins[$notification_plugin_id])) {
    $index_label = $this
      ->label();
    throw new SavedSearchesException("The datasource with ID '{$notification_plugin_id}' could not be retrieved for index '{$index_label}'.");
  }
  return $notification_plugins[$notification_plugin_id];
}