class YamlDiscoveryDecorator
Same name in other branches
- 9 core/lib/Drupal/Core/Plugin/Discovery/YamlDiscoveryDecorator.php \Drupal\Core\Plugin\Discovery\YamlDiscoveryDecorator
- 8.9.x core/lib/Drupal/Core/Plugin/Discovery/YamlDiscoveryDecorator.php \Drupal\Core\Plugin\Discovery\YamlDiscoveryDecorator
- 10 core/lib/Drupal/Core/Plugin/Discovery/YamlDiscoveryDecorator.php \Drupal\Core\Plugin\Discovery\YamlDiscoveryDecorator
Enables YAML discovery for plugin definitions.
You should normally extend this class to add validation for the values in the YAML data or to restrict use of the class or derivatives keys.
Hierarchy
- class \Drupal\Core\Plugin\Discovery\YamlDiscovery implements \Drupal\Component\Plugin\Discovery\DiscoveryInterface uses \Drupal\Component\Plugin\Discovery\DiscoveryTrait
- class \Drupal\Core\Plugin\Discovery\YamlDiscoveryDecorator extends \Drupal\Core\Plugin\Discovery\YamlDiscovery
Expanded class hierarchy of YamlDiscoveryDecorator
4 files declare their use of YamlDiscoveryDecorator
- CKEditor5PluginManager.php in core/
modules/ ckeditor5/ src/ Plugin/ CKEditor5PluginManager.php - HelpTopicPluginManager.php in core/
modules/ help/ src/ HelpTopicPluginManager.php - LayoutPluginManager.php in core/
lib/ Drupal/ Core/ Layout/ LayoutPluginManager.php - YamlDiscoveryDecoratorTest.php in core/
tests/ Drupal/ Tests/ Core/ Plugin/ Discovery/ YamlDiscoveryDecoratorTest.php
File
-
core/
lib/ Drupal/ Core/ Plugin/ Discovery/ YamlDiscoveryDecorator.php, line 13
Namespace
Drupal\Core\Plugin\DiscoveryView source
class YamlDiscoveryDecorator extends YamlDiscovery {
/**
* The Discovery object being decorated.
*
* @var \Drupal\Component\Plugin\Discovery\DiscoveryInterface
*/
protected $decorated;
/**
* Constructs a YamlDiscoveryDecorator object.
*
* @param \Drupal\Component\Plugin\Discovery\DiscoveryInterface $decorated
* The discovery object that is being decorated.
* @param string $name
* The file name suffix to use for discovery; for instance, 'test' will
* become 'MODULE.test.yml'.
* @param array $directories
* An array of directories to scan.
*/
public function __construct(DiscoveryInterface $decorated, $name, array $directories) {
parent::__construct($name, $directories);
$this->decorated = $decorated;
}
/**
* {@inheritdoc}
*/
public function getDefinitions() {
return parent::getDefinitions() + $this->decorated
->getDefinitions();
}
/**
* Passes through all unknown calls onto the decorated object.
*/
public function __call($method, $args) {
return call_user_func_array([
$this->decorated,
$method,
], $args);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
DiscoveryTrait::doGetDefinition | protected | function | Gets a specific plugin definition. | ||
DiscoveryTrait::getDefinition | public | function | 3 | ||
DiscoveryTrait::hasDefinition | public | function | |||
YamlDiscovery::$discovery | protected | property | YAML file discovery and parsing handler. | ||
YamlDiscovery::$translatableProperties | protected | property | Contains an array of translatable properties passed along to t(). | ||
YamlDiscovery::addTranslatableProperty | public | function | Set one of the YAML values as being translatable. | ||
YamlDiscoveryDecorator::$decorated | protected | property | The Discovery object being decorated. | ||
YamlDiscoveryDecorator::getDefinitions | public | function | Overrides YamlDiscovery::getDefinitions | ||
YamlDiscoveryDecorator::__call | public | function | Passes through all unknown calls onto the decorated object. | ||
YamlDiscoveryDecorator::__construct | public | function | Constructs a YamlDiscoveryDecorator object. | Overrides YamlDiscovery::__construct |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.