ImportPluginManager.php in Search API Synonym 8
File
src/Import/ImportPluginManager.php
View source
<?php
namespace Drupal\search_api_synonym\Import;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\DefaultPluginManager;
class ImportPluginManager extends DefaultPluginManager {
protected $pluginId;
protected $importOptions;
public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
parent::__construct('Plugin/search_api_synonym/import', $namespaces, $module_handler, 'Drupal\\search_api_synonym\\Import\\ImportPluginInterface', 'Drupal\\search_api_synonym\\Annotation\\SearchApiSynonymImport');
$this
->alterInfo('search_api_synonym_import_info');
$this
->setCacheBackend($cache_backend, 'search_api_synonym_import_info_plugins');
}
public function setPluginId($plugin_id) {
$this->pluginId = $plugin_id;
}
public function getPluginId() {
return $this->pluginId;
}
public function getAvailableImportPlugins() {
$plugins = $this
->getDefinitions();
$output = [];
foreach ($plugins as $id => $definition) {
$output[$id] = $definition;
}
return $output;
}
public function validatePlugin($plugin) {
if ($this
->getDefinition($plugin, FALSE)) {
return TRUE;
}
else {
return FALSE;
}
}
}