drupal_get_filename

function drupal_get_filename

drupal_get_filename($type, $name, $filename = NULL)

Returns and optionally sets the filename for a system resource.

The filename, whether provided, cached, or retrieved from the database, is only returned if the file exists.

This function plays a key role in allowing Drupal's resources (modules and themes) to be located in different places depending on a site's configuration. For example, a module 'foo' may legally be located in any of these three places:

core/modules/foo/foo.info.yml modules/foo/foo.info.yml sites/example.com/modules/foo/foo.info.yml

Calling drupal_get_filename('module', 'foo') will give you one of the above, depending on where the module is located.

Pa