class PluginWrapper in RESTful 7.2
Hierarchy
- class \Drupal\restful\Plugin\resource\DataInterpreter\PluginWrapper implements PluginWrapperInterface
Expanded class hierarchy of PluginWrapper
1 file declares its use of PluginWrapper
- DataProviderPlug.php in src/
Plugin/ resource/ DataProvider/ DataProviderPlug.php - Contains \Drupal\restful\Plugin\resource\DataProvider\DataProviderPlug.
File
- src/
Plugin/ resource/ DataInterpreter/ PluginWrapper.php, line 13 - Contains \Drupal\restful\Plugin\resource\DataInterpreter\PluginWrapper.
Namespace
Drupal\restful\Plugin\resource\DataInterpreterView source
class PluginWrapper implements PluginWrapperInterface {
/**
* Plugin configuration.
*
* @var array
*/
protected $pluginConfiguration = array();
/**
* Plugin definition.
*
* @var array
*/
protected $pluginDefinition = array();
/**
* Plugin instance.
*
* @var PluginInspectionInterface
*/
protected $plugin;
/**
* Constructs a PluginWrapper object.
*
* @param PluginInspectionInterface $plugin
* The plugin to wrap.
*/
public function __construct(PluginInspectionInterface $plugin) {
$this->plugin = $plugin;
$this->pluginDefinition = $plugin
->getPluginDefinition();
// For configurable plugins, expose those properties as well.
if ($plugin instanceof ConfigurablePluginInterface) {
$this->pluginConfiguration = $plugin
->getConfiguration();
}
}
/**
* {@inheritdoc}
*/
public function get($key) {
// If there is a key by that name in the plugin configuration return it, if
// not then check the plugin definition. If it cannot be found, return NULL.
$value = isset($this->pluginConfiguration[$key]) ? $this->pluginConfiguration[$key] : NULL;
return $value ? $value : (isset($this->pluginDefinition[$key]) ? $this->pluginDefinition[$key] : NULL);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PluginWrapper:: |
protected | property | Plugin instance. | |
PluginWrapper:: |
protected | property | Plugin configuration. | |
PluginWrapper:: |
protected | property | Plugin definition. | |
PluginWrapper:: |
public | function |
Gets a field from the plugin configuration. Overrides PluginWrapperInterface:: |
|
PluginWrapper:: |
public | function | Constructs a PluginWrapper object. |