public function NotificationPluginManager::createPlugin in Search API Saved Searches 8
Creates a notification plugin for the given saved search type.
Parameters
\Drupal\search_api_saved_searches\SavedSearchTypeInterface $type: The saved search type.
string $plugin_id: The ID of the notification plugin to create.
array $configuration: (optional) The configuration to set for the plugin.
Return value
\Drupal\search_api_saved_searches\Notification\NotificationPluginInterface The created notification plugin.
Throws
\Drupal\search_api_saved_searches\SavedSearchesException Thrown if an unknown plugin ID is given.
Overrides NotificationPluginManagerInterface::createPlugin
1 call to NotificationPluginManager::createPlugin()
- NotificationPluginManager::createPlugins in src/
Notification/ NotificationPluginManager.php - Creates multiple notification plugins for the given saved search type.
File
- src/
Notification/ NotificationPluginManager.php, line 43
Class
- NotificationPluginManager
- Manages notification plugins.
Namespace
Drupal\search_api_saved_searches\NotificationCode
public function createPlugin(SavedSearchTypeInterface $type, $plugin_id, array $configuration = NULL) {
try {
$configuration['#saved_search_type'] = $type;
return $this
->createInstance($plugin_id, $configuration);
} catch (PluginException $e) {
throw new SavedSearchesException("Unknown notification plugin with ID '{$plugin_id}'");
}
}