DisableDeriver.php in Drupal 7 to 8/9 Module Upgrader 8
File
src/Plugin/DMU/Converter/Functions/DisableDeriver.php
View source
<?php
namespace Drupal\drupalmoduleupgrader\Plugin\DMU\Converter\Functions;
use Drupal\drupalmoduleupgrader\DeriverBase;
class DisableDeriver extends DeriverBase {
public function getDerivativeDefinitions($base_definition) {
$derivatives = [];
$config = \Drupal::config('drupalmoduleupgrader.functions')
->get('definitions');
foreach ($config as $key => $info) {
if (empty($info['disable'])) {
continue;
}
if (empty($info['functions'])) {
$info['functions'] = [
$key,
];
}
foreach ($info['functions'] as $function) {
$derivative = $base_definition;
$variables = [
'@function' => $function . '()',
];
$derivative['function'] = $function;
$derivative['description'] = $this
->t('Disables calls to @function().', $variables);
if (isset($info['fixme'])) {
$derivative['fixme'] = $this
->t($info['fixme'], $variables);
}
$derivative['documentation'] = $info['documentation'];
$derivatives[$function] = $derivative;
}
}
return $derivatives;
}
}
Classes
Name |
Description |
DisableDeriver |
Builds derivative definitions for the _disable plugin, based on a bundled configuration
file. This allows us (plugin authors) to easily define which function calls can be
commented out. |