Further modules included.
[yaffs-website] / web / modules / contrib / drupalmoduleupgrader / src / Plugin / DMU / Converter / Functions / FormLoadInclude.php
diff --git a/web/modules/contrib/drupalmoduleupgrader/src/Plugin/DMU/Converter/Functions/FormLoadInclude.php b/web/modules/contrib/drupalmoduleupgrader/src/Plugin/DMU/Converter/Functions/FormLoadInclude.php
new file mode 100644 (file)
index 0000000..0c5332c
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+
+namespace Drupal\drupalmoduleupgrader\Plugin\DMU\Converter\Functions;
+
+use Drupal\drupalmoduleupgrader\TargetInterface;
+use Pharborist\Functions\FunctionCallNode;
+use Pharborist\Objects\ObjectMethodCallNode;
+
+/**
+ * @Converter(
+ *  id = "form_load_include",
+ *  description = @Translation("Rewrites calls to form_load_include().")
+ * )
+ */
+class FormLoadInclude extends FunctionCallModifier {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function rewrite(FunctionCallNode $call, TargetInterface $target) {
+    $arguments = $call->getArguments();
+
+    $rewritten = ObjectMethodCallNode::create(clone $arguments[0], 'loadInclude')
+      ->appendArgument(clone $arguments[2])
+      ->appendArgument(clone $arguments[1]);
+
+    if (sizeof($arguments) == 4) {
+      $rewritten->appendArgument(clone $arguments[3]);
+    }
+
+    return $rewritten;
+  }
+
+}