Further modules included.
[yaffs-website] / web / modules / contrib / drupalmoduleupgrader / src / Plugin / DMU / Converter / HookURLOutboundAlter.php
1 <?php
2
3 namespace Drupal\drupalmoduleupgrader\Plugin\DMU\Converter;
4
5 use Drupal\drupalmoduleupgrader\ConverterBase;
6 use Drupal\drupalmoduleupgrader\TargetInterface;
7
8 /**
9  * @Converter(
10  *  id = "hook_url_outbound_alter",
11  *  description = @Translation("Converts hook_url_outbound_alter() to a service."),
12  *  hook = "hook_url_outbound_alter"
13  * )
14  */
15 class HookURLOutboundAlter extends ConverterBase {
16
17   /**
18    * {@inheritdoc}
19    */
20   public function convert(TargetInterface $target) {
21     $this->writeService($target, 'outbound_path_processor', [
22       'class' => 'Drupal\\' . $target->id() . '\\OutboundPathProcessor',
23       'tags' => [
24         [ 'name' => 'path_processor_outbound' ],
25       ],
26     ]);
27
28     $render = [
29       '#theme' => 'dmu_outbound_path_processor',
30       '#module' => $target->id(),
31     ];
32     $processor = $this->parse($render);
33     $target
34       ->getIndexer('function')
35       ->get('hook_url_outbound_alter')
36       ->cloneAsMethodOf($processor)
37       ->setName('processOutbound');
38     $this->writeClass($target, $processor);
39   }
40
41 }