Configurable
ExtensionPathRector
Fixes deprecated drupal_get_filename() calls
-drupal_get_filename('module', 'node');
-drupal_get_filename('theme', 'seven');
-drupal_get_filename('profile', 'standard');
+\Drupal::service('extension.list.module')->getPathname('node');
+\Drupal::service('extension.list.theme')->getPathname('seven');
+\Drupal::service('extension.list.profile')->getPathname('standard');
Configure your rector.php:
<?php
use DrupalRector\Drupal9\Rector\Deprecation\ExtensionPathRector;
use DrupalRector\Drupal9\Rector\ValueObject\ExtensionPathConfiguration;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withConfiguredRule(ExtensionPathRector::class, [
new ExtensionPathConfiguration('drupal_get_filename', 'getPathname'),
]);
-drupal_get_path('module', 'node');
-drupal_get_path('theme', 'seven');
-drupal_get_path('profile', 'standard');
+\Drupal::service('extension.list.module')->getPath('node');
+\Drupal::service('extension.list.theme')->getPath('seven');
+\Drupal::service('extension.list.profile')->getPath('standard');
Configure your rector.php:
<?php
use DrupalRector\Drupal9\Rector\Deprecation\ExtensionPathRector;
use DrupalRector\Drupal9\Rector\ValueObject\ExtensionPathConfiguration;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withConfiguredRule(ExtensionPathRector::class, [
new ExtensionPathConfiguration('drupal_get_path', 'getPath'),
]);