ModuleInvokeAll.php in Drupal 7 to 8/9 Module Upgrader 8
File
src/Plugin/DMU/Converter/Functions/ModuleInvokeAll.php
View source
<?php
namespace Drupal\drupalmoduleupgrader\Plugin\DMU\Converter\Functions;
use Drupal\drupalmoduleupgrader\TargetInterface;
use Pharborist\Functions\FunctionCallNode;
use Pharborist\Objects\ClassMethodCallNode;
use Pharborist\Types\ArrayNode;
class ModuleInvokeAll extends FunctionCallModifier {
public function rewrite(FunctionCallNode $call, TargetInterface $target) {
$arguments = $call
->getArguments()
->toArray();
$rewritten = ClassMethodCallNode::create('\\Drupal', 'moduleHandler')
->appendMethodCall('invokeAll')
->appendArgument(array_shift($arguments));
if ($arguments) {
$rewritten
->appendArgument(ArrayNode::create($arguments));
}
return $rewritten;
}
}
Classes
Name |
Description |
ModuleInvokeAll |
Plugin annotation
@Converter(
id = "module_invoke_all",
description = @Translation("Rewrites calls to module_invoke_all().")
) |