Changelog:
Drupal_get_path()
and drupal_get_filename()
have been deprecated. Use an extension type-specific \Drupal\Core\Extension\ExtensionList::getPath()
and \Drupal\Core\Extension\ExtensionList::getPathname()
instead where possible. You can use \Drupal::service('extension.path.resolver')->getPath()/getPathname()
and dynamically pass in the extension type as the first parameter.
Before:
drupal_get_path('theme', 'MYTHEME') . '/css/main.css';
After:
\Drupal::service('extension.list.theme')->getPath('MYTHEME')