class ConfigurableTestClass
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/Core/Plugin/ConfigurableTraitTest.php \Drupal\Tests\Core\Plugin\ConfigurableTestClass
A test class using ConfigurablePluginTrait that can modify the de.
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Tests\Core\Plugin\ConfigurableTestClass implements \Drupal\Component\Plugin\ConfigurableInterface uses \Drupal\Core\Plugin\ConfigurableTrait extends \Drupal\Component\Plugin\PluginBase
Expanded class hierarchy of ConfigurableTestClass
File
-
core/
tests/ Drupal/ Tests/ Core/ Plugin/ ConfigurableTraitTest.php, line 162
Namespace
Drupal\Tests\Core\PluginView source
class ConfigurableTestClass extends PluginBase implements ConfigurableInterface {
use ConfigurableTrait {
defaultConfiguration as traitDefaultConfiguration;
}
/**
* A default configuration for the test class to return.
*
* @var array|null
*/
protected ?array $defaultConfiguration = NULL;
/**
* {@inheritdoc}
*/
public function __construct(array $configuration = [], string $plugin_id = '', array $plugin_definition = []) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->setConfiguration($configuration);
}
/**
* Sets the default configuration this test will return.
*
* @param array $default_configuration
* The default configuration to use.
*/
public function setDefaultConfiguration(array $default_configuration) : void {
$this->defaultConfiguration = $default_configuration;
}
/**
* {@inheritdoc}
*/
public function defaultConfiguration() : array {
return $this->defaultConfiguration ?? $this->traitDefaultConfiguration();
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary | Member alias | Overriden Title | Overrides |
|---|---|---|---|---|---|---|
| ConfigurableTestClass::$defaultConfiguration | protected | property | A default configuration for the test class to return. | |||
| ConfigurableTestClass::defaultConfiguration | public | function | Gets default configuration for this plugin. | Overrides ConfigurableInterface::defaultConfiguration | ||
| ConfigurableTestClass::setDefaultConfiguration | public | function | Sets the default configuration this test will return. | |||
| ConfigurableTestClass::__construct | public | function | Constructs a \Drupal\Component\Plugin\PluginBase object. | Overrides PluginBase::__construct | ||
| ConfigurableTrait::$configuration | protected | property | Configuration information passed into the plugin. | |||
| ConfigurableTrait::defaultConfiguration | public | function | Gets default configuration for this plugin. | Aliased as: traitDefaultConfiguration | 15 | |
| ConfigurableTrait::getConfiguration | public | function | Gets this plugin's configuration. | 3 | ||
| ConfigurableTrait::setConfiguration | public | function | Sets the configuration for this plugin instance. | 2 | ||
| PluginBase::$pluginDefinition | protected | property | The plugin implementation definition. | 1 | ||
| PluginBase::$pluginId | protected | property | The plugin ID. | |||
| PluginBase::DERIVATIVE_SEPARATOR | constant | A string which is used to separate base plugin IDs from the derivative ID. | ||||
| PluginBase::getBaseId | public | function | Gets the base_plugin_id of the plugin instance. | Overrides DerivativeInspectionInterface::getBaseId | ||
| PluginBase::getDerivativeId | public | function | Gets the derivative_id of the plugin instance. | Overrides DerivativeInspectionInterface::getDerivativeId | ||
| PluginBase::getPluginDefinition | public | function | Gets the definition of the plugin implementation. | Overrides PluginInspectionInterface::getPluginDefinition | 2 | |
| PluginBase::getPluginId | public | function | Gets the plugin ID of the plugin instance. | Overrides PluginInspectionInterface::getPluginId |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.