A plugin manager for condition plugins.
Expanded class hierarchy of ConditionManager
class ConditionManager extends PluginManagerBase implements ExecutableManagerInterface {
/**
* Constructs aa ConditionManager object.
*
* @param \Traversable $namespaces
* An object that implements \Traversable which contains the root paths
* keyed by the corresponding namespace to look for plugin implementations,
*/
public function __construct(\Traversable $namespaces) {
$this->discovery = new AnnotatedClassDiscovery('Condition', $namespaces);
$this->discovery = new DerivativeDiscoveryDecorator($this->discovery);
$this->discovery = new AlterDecorator($this->discovery, 'condition_info');
$this->discovery = new CacheDecorator($this->discovery, 'condition:' . language(Language::TYPE_INTERFACE)->langcode);
$this->factory = new DefaultFactory($this);
}
/**
* Override of Drupal\Component\Plugin\PluginManagerBase::createInstance().
*/
public function createInstance($plugin_id, array $configuration = array()) {
$plugin = $this->factory
->createInstance($plugin_id, $configuration);
return $plugin
->setExecutableManager($this);
}
/**
* Implements Drupal\Core\Executable\ExecutableManagerInterface::execute().
*/
public function execute(ExecutableInterface $condition) {
$result = $condition
->evaluate();
return $condition
->isNegated() ? !$result : $result;
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConditionManager:: |
public | function |
Override of Drupal\Component\Plugin\PluginManagerBase::createInstance(). Overrides PluginManagerBase:: |
|
ConditionManager:: |
public | function |
Implements Drupal\Core\Executable\ExecutableManagerInterface::execute(). Overrides ExecutableManagerInterface:: |
|
ConditionManager:: |
public | function | Constructs aa ConditionManager object. | |
PluginManagerBase:: |
protected | property | A set of defaults to be referenced by $this->processDefinition() if additional processing of plugins is necessary or helpful for development purposes. | 3 |
PluginManagerBase:: |
protected | property | The object that discovers plugins managed by this manager. | |
PluginManagerBase:: |
protected | property | The object that instantiates plugins managed by this manager. | |
PluginManagerBase:: |
protected | property | The object that returns the preconfigured plugin instance appropriate for a particular runtime condition. | |
PluginManagerBase:: |
public | function |
Clears static and persistent plugin definition caches. Overrides CachedDiscoveryInterface:: |
|
PluginManagerBase:: |
public | function |
Gets a specific plugin definition. Overrides DiscoveryInterface:: |
|
PluginManagerBase:: |
public | function |
Gets the definition of all plugins for this type. Overrides DiscoveryInterface:: |
|
PluginManagerBase:: |
public | function |
Returns a preconfigured instance of a plugin. Overrides MapperInterface:: |
6 |
PluginManagerBase:: |
public | function | Performs extra processing on plugin definitions. | 2 |