Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By sun on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Issue links:
Description:
drupal_get_filename()
always returns the relative pathname of the main extension file now — regardless of whether such a file exists.
Drupal 7
$pathname = drupal_get_filename('module', 'node');
var_dump($pathname);
$pathname = drupal_get_filename('theme', 'stark');
var_dump($pathname);
core/modules/node/node.module
core/themes/stark/stark.info
Drupal 8
$pathname = drupal_get_filename('module', 'node');
var_dump($pathname);
$pathname = drupal_get_filename('theme', 'stark');
var_dump($pathname);
core/modules/node/node.module
core/themes/stark/stark.theme
Note
drupal_get_filename()
will most likely be removed prior to the release of Drupal 8.0. It is mostly used internally by Drupal core. If your code relies on it, change it to use the information from respective extension handlers instead; e.g., ModuleHandler::getModuleList()
.
Impacts:
Module developers