FormExecuteHandlers.php in Drupal 7 to 8/9 Module Upgrader 8
File
src/Plugin/DMU/Converter/Functions/FormExecuteHandlers.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\StringNode;
class FormExecuteHandlers extends FunctionCallModifier {
public function rewrite(FunctionCallNode $call, TargetInterface $target) {
$arguments = $call
->getArguments();
if ($arguments[0] instanceof StringNode) {
$handler_type = $arguments[0]
->toValue();
if ($handler_type == 'validate' || $handler_type == 'submit') {
return ClassMethodCallNode::create('\\Drupal', 'formBuilder')
->appendMethodCall('execute' . ucfirst($handler_type) . 'Handlers')
->appendArgument(clone $arguments[1])
->appendArgument(clone $arguments[2]);
}
}
}
}
Classes
Name |
Description |
FormExecuteHandlers |
Plugin annotation
@Converter(
id = "form_execute_handlers",
description = @Translation("Rewrites calls to form_execute_handlers()."),
fixme = @Translation("form_execute_handlers() has been split into the executeValidateHandlers() and… |