PluginWrapper.php in RESTful 7.2
File
src/Plugin/resource/DataInterpreter/PluginWrapper.php
View source
<?php
namespace Drupal\restful\Plugin\resource\DataInterpreter;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Drupal\Component\Plugin\PluginInspectionInterface;
class PluginWrapper implements PluginWrapperInterface {
protected $pluginConfiguration = array();
protected $pluginDefinition = array();
protected $plugin;
public function __construct(PluginInspectionInterface $plugin) {
$this->plugin = $plugin;
$this->pluginDefinition = $plugin
->getPluginDefinition();
if ($plugin instanceof ConfigurablePluginInterface) {
$this->pluginConfiguration = $plugin
->getConfiguration();
}
}
public function get($key) {
$value = isset($this->pluginConfiguration[$key]) ? $this->pluginConfiguration[$key] : NULL;
return $value ? $value : (isset($this->pluginDefinition[$key]) ? $this->pluginDefinition[$key] : NULL);
}
}