DrupalGetTitle.php in Drupal 7 to 8/9 Module Upgrader 8
File
src/Plugin/DMU/Converter/Functions/DrupalGetTitle.php
View source
<?php
namespace Drupal\drupalmoduleupgrader\Plugin\DMU\Converter\Functions;
use Drupal\drupalmoduleupgrader\TargetInterface;
use Pharborist\Functions\FunctionCallNode;
use Pharborist\Objects\ClassMethodCallNode;
class DrupalGetTitle extends FunctionCallModifier {
public function rewrite(FunctionCallNode $call, TargetInterface $target) {
return ClassMethodCallNode::create('\\Drupal', 'service')
->appendArgument('title_resolver')
->appendMethodCall('getTitle')
->appendArgument(ClassMethodCallNode::create('\\Drupal', 'request'))
->appendArgument(ClassMethodCallNode::create('\\Drupal', 'routeMatch')
->appendMethodCall('getRouteObject'));
}
}
Classes
Name |
Description |
DrupalGetTitle |
Plugin annotation
@Converter(
id = "drupal_get_title",
description = @Translation("Rewrites calls to drupal_get_title().")
) |