ConfigurablePluginBase.php in Search API 8
File
src/Plugin/ConfigurablePluginBase.php
View source
<?php
namespace Drupal\search_api\Plugin;
use Drupal\Component\Plugin\PluginInspectionInterface;
use Drupal\Core\Plugin\PluginDependencyTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;
abstract class ConfigurablePluginBase extends HideablePluginBase implements ConfigurablePluginInterface {
use PluginDependencyTrait {
getPluginDependencies as traitGetPluginDependencies;
calculatePluginDependencies as traitCalculatePluginDependencies;
moduleHandler as traitModuleHandler;
themeHandler as traitThemeHandler;
}
public function __construct(array $configuration, $plugin_id, array $plugin_definition) {
$configuration += $this
->defaultConfiguration();
parent::__construct($configuration, $plugin_id, $plugin_definition);
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
$plugin = new static($configuration, $plugin_id, $plugin_definition);
$translation = $container
->get('string_translation');
$plugin
->setStringTranslation($translation);
return $plugin;
}
public function label() {
$plugin_definition = $this
->getPluginDefinition();
return $plugin_definition['label'];
}
public function getDescription() {
$plugin_definition = $this
->getPluginDefinition();
return $plugin_definition['description'] ?? '';
}
public function defaultConfiguration() {
return [];
}
public function getConfiguration() {
return $this->configuration;
}
public function setConfiguration(array $configuration) {
$this->configuration = $configuration + $this
->defaultConfiguration();
}
public function calculateDependencies() {
return [];
}
public function onDependencyRemoval(array $dependencies) {
return FALSE;
}
protected function getPluginDependencies(PluginInspectionInterface $instance) {
@trigger_error('The use of \\Drupal\\Core\\Plugin\\PluginDependencyTrait via \\Drupal\\search_api\\Plugin\\ConfigurablePluginBase is deprecated in search_api:8.x-1.16 and is removed from search_api:2.0.0. Add \\Drupal\\Core\\Plugin\\PluginDependencyTrait manually for your class if you need it. See https://www.drupal.org/node/3099004', E_USER_DEPRECATED);
return $this
->traitGetPluginDependencies($instance);
}
protected function calculatePluginDependencies(PluginInspectionInterface $instance) {
@trigger_error('The use of \\Drupal\\Core\\Plugin\\PluginDependencyTrait via \\Drupal\\search_api\\Plugin\\ConfigurablePluginBase is deprecated in search_api:8.x-1.16 and is removed from search_api:2.0.0. Add \\Drupal\\Core\\Plugin\\PluginDependencyTrait manually for your class if you need it. See https://www.drupal.org/node/3099004', E_USER_DEPRECATED);
$this
->traitCalculatePluginDependencies($instance);
}
protected function moduleHandler() {
@trigger_error('The use of \\Drupal\\Core\\Plugin\\PluginDependencyTrait via \\Drupal\\search_api\\Plugin\\ConfigurablePluginBase is deprecated in search_api:8.x-1.16 and is removed from search_api:2.0.0. Add \\Drupal\\Core\\Plugin\\PluginDependencyTrait manually for your class if you need it. See https://www.drupal.org/node/3099004', E_USER_DEPRECATED);
return $this
->traitModuleHandler();
}
protected function themeHandler() {
@trigger_error('The use of \\Drupal\\Core\\Plugin\\PluginDependencyTrait via \\Drupal\\search_api\\Plugin\\ConfigurablePluginBase is deprecated in search_api:8.x-1.16 and is removed from search_api:2.0.0. Add \\Drupal\\Core\\Plugin\\PluginDependencyTrait manually for your class if you need it. See https://www.drupal.org/node/3099004', E_USER_DEPRECATED);
return $this
->traitThemeHandler();
}
}