class CToolsPluginDiscovery in Service Container 7
Same name and namespace in other branches
- 7.2 src/Plugin/Discovery/CToolsPluginDiscovery.php \Drupal\service_container\Plugin\Discovery\CToolsPluginDiscovery
A discovery mechanism that uses ctools plugins for Drupal 7 compatibility.
This class cannot be tested as it relies on the existence of procedural code. @codeCoverageIgnore
Hierarchy
- class \Drupal\service_container\Plugin\Discovery\CToolsPluginDiscovery implements DiscoveryInterface
Expanded class hierarchy of CToolsPluginDiscovery
1 file declares its use of CToolsPluginDiscovery
- ServiceProviderPluginManager.php in src/
DependencyInjection/ ServiceProviderPluginManager.php - Contains \Drupal\service_container\DependencyInjection\ServiceProviderPluginManager
File
- src/
Plugin/ Discovery/ CToolsPluginDiscovery.php, line 19 - Contains \Drupal\service_container\Plugin\Discovery\CToolsPluginDiscovery
Namespace
Drupal\service_container\Plugin\DiscoveryView source
class CToolsPluginDiscovery implements DiscoveryInterface {
/**
* The owning module.
*
* @var string
*/
protected $pluginOwner;
/**
* The plugin type.
*
* @var string
*/
protected $pluginType;
/**
* Constructs a CToolsPluginDiscovery object.
*
* @param array $plugin_manager_definition
* The domain specific plugin manager definition.
*/
public function __construct($plugin_manager_definition) {
$this->pluginOwner = $plugin_manager_definition['owner'];
$this->pluginType = $plugin_manager_definition['type'];
}
/**
* {@inheritdoc}
*/
public function getDefinitions() {
ctools_include('plugins');
return ctools_get_plugins($this->pluginOwner, $this->pluginType);
}
/**
* {@inheritdoc}
*/
public function getDefinition($plugin_id, $exception_on_invalid = TRUE) {
ctools_include('plugins');
$definition = ctools_get_plugins($this->pluginOwner, $this->pluginType, $plugin_id);
if (!$definition && $exception_on_invalid) {
throw new PluginNotFoundException($plugin_id, sprintf('The "%s" plugin does not exist.', $plugin_id));
}
return $definition;
}
/**
* {@inheritdoc}
*/
public function hasDefinition($plugin_id) {
return (bool) $this
->getDefinition($plugin_id, FALSE);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CToolsPluginDiscovery:: |
protected | property | The owning module. | |
CToolsPluginDiscovery:: |
protected | property | The plugin type. | |
CToolsPluginDiscovery:: |
public | function |
Gets a specific plugin definition. Overrides DiscoveryInterface:: |
|
CToolsPluginDiscovery:: |
public | function |
Gets the definition of all plugins for this type. Overrides DiscoveryInterface:: |
|
CToolsPluginDiscovery:: |
public | function |
Indicates if a specific plugin definition exists. Overrides DiscoveryInterface:: |
|
CToolsPluginDiscovery:: |
public | function | Constructs a CToolsPluginDiscovery object. |