Further modules included.
[yaffs-website] / web / modules / contrib / drupalmoduleupgrader / src / Plugin / DMU / Converter / HookURLOutboundAlter.php
diff --git a/web/modules/contrib/drupalmoduleupgrader/src/Plugin/DMU/Converter/HookURLOutboundAlter.php b/web/modules/contrib/drupalmoduleupgrader/src/Plugin/DMU/Converter/HookURLOutboundAlter.php
new file mode 100644 (file)
index 0000000..09a4e07
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+
+namespace Drupal\drupalmoduleupgrader\Plugin\DMU\Converter;
+
+use Drupal\drupalmoduleupgrader\ConverterBase;
+use Drupal\drupalmoduleupgrader\TargetInterface;
+
+/**
+ * @Converter(
+ *  id = "hook_url_outbound_alter",
+ *  description = @Translation("Converts hook_url_outbound_alter() to a service."),
+ *  hook = "hook_url_outbound_alter"
+ * )
+ */
+class HookURLOutboundAlter extends ConverterBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function convert(TargetInterface $target) {
+    $this->writeService($target, 'outbound_path_processor', [
+      'class' => 'Drupal\\' . $target->id() . '\\OutboundPathProcessor',
+      'tags' => [
+        [ 'name' => 'path_processor_outbound' ],
+      ],
+    ]);
+
+    $render = [
+      '#theme' => 'dmu_outbound_path_processor',
+      '#module' => $target->id(),
+    ];
+    $processor = $this->parse($render);
+    $target
+      ->getIndexer('function')
+      ->get('hook_url_outbound_alter')
+      ->cloneAsMethodOf($processor)
+      ->setName('processOutbound');
+    $this->writeClass($target, $processor);
+  }
+
+}