KeyPluginBase.php in Key 8
File
src/Plugin/KeyPluginBase.php
View source
<?php
namespace Drupal\key\Plugin;
use Drupal\Core\Plugin\PluginBase;
use Drupal\Component\Utility\NestedArray;
use Symfony\Component\DependencyInjection\ContainerInterface;
abstract class KeyPluginBase extends PluginBase implements KeyPluginInterface {
public function __construct(array $configuration, $plugin_id, $plugin_definition) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->configuration = NestedArray::mergeDeep($this
->defaultConfiguration(), $this->configuration);
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition);
}
public function getPluginType() {
return $this->pluginDefinition['plugin_type'];
}
public function defaultConfiguration() {
return [];
}
public function getConfiguration() {
return $this->configuration;
}
public function setConfiguration(array $configuration) {
$this->configuration = $configuration;
}
public function calculateDependencies() {
return [];
}
}