class GenericDeriver in Drupal 7 to 8/9 Module Upgrader 8
Builds derivative definitions for the generic rewriter, based on the drupalmoduleupgrader.rewriters configuration object.
Hierarchy
- class \Drupal\drupalmoduleupgrader\Plugin\DMU\Rewriter\GenericDeriver implements ContainerDeriverInterface
Expanded class hierarchy of GenericDeriver
File
- src/
Plugin/ DMU/ Rewriter/ GenericDeriver.php, line 12
Namespace
Drupal\drupalmoduleupgrader\Plugin\DMU\RewriterView source
class GenericDeriver implements ContainerDeriverInterface {
/**
* @var array
*/
protected $config;
public function __construct(array $config) {
$this->config = $config;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($container
->get('config.factory')
->get('drupalmoduleupgrader.rewriters')
->get('definitions'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinition($derivative_id, $base_definition) {
$derivatives = $this
->getDerivativeDefinitions($base_definition);
if (isset($derivatives[$derivative_id])) {
return $derivatives[$derivative_id];
}
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_definition) {
$derivatives = [];
foreach ($this->config as $data_type => $definition) {
$derivatives[$data_type] = $definition + $base_definition;
}
return $derivatives;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
GenericDeriver:: |
protected | property | ||
GenericDeriver:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
GenericDeriver:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |
|
GenericDeriver:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverInterface:: |
|
GenericDeriver:: |
public | function |