function drupal_get_path in Drupal 9
Same name and namespace in other branches
- 8 core/includes/bootstrap.inc \drupal_get_path()
- 4 includes/common.inc \drupal_get_path()
- 5 includes/common.inc \drupal_get_path()
- 6 includes/common.inc \drupal_get_path()
- 7 includes/common.inc \drupal_get_path()
Returns the path to a system item (module, theme, etc.).
Parameters
$type: The type of the item; one of 'core', 'profile', 'module', 'theme', or 'theme_engine'.
$name: The name of the item for which the path is requested. Ignored for $type 'core'.
Return value
string The path to the requested item or an empty string if the item is not found.
Deprecated
in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Drupal\Core\Extension\ExtensionPathResolver::getPath() instead.
See also
https://www.drupal.org/node/2940438
\Drupal\Core\Extension\ExtensionList::getPath()
1 call to drupal_get_path()
- GetFilenameTest::testDrupalGetPath in core/
tests/ Drupal/ KernelTests/ Core/ Bootstrap/ GetFilenameTest.php - Tests drupal_get_path() deprecation.
File
- core/
includes/ bootstrap.inc, line 246 - Functions that need to be loaded on every Drupal request.
Code
function drupal_get_path($type, $name) {
@trigger_error('drupal_get_path() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \\Drupal\\Core\\Extension\\ExtensionPathResolver::getPath() instead. See https://www.drupal.org/node/2940438', E_USER_DEPRECATED);
return dirname(drupal_get_filename($type, $name));
}