1 color.module | _color_get_file_path($filename, $theme_name) |
Finds the original file path of a CSS file from the color configuration.
Parameters
$filename: The file name that we are searching for.
$theme_name: The name of the theme that is being modified.
Return value
string: Returns the original file path of the CSS file.
File
- core/
modules/ color/ color.module, line 757 - Allows users to change the color scheme of themes.
Code
function _color_get_file_path($filename, $theme_name) {
static $basenames = array();
$themes = list_themes();
$theme = $themes[$theme_name];
$basename = backdrop_basename($filename);
if (isset($theme->stylesheets)) {
foreach ($theme->stylesheets as $group_name => $group) {
foreach ($group as $file) {
if (!isset($basenames[$theme_name][$group_name][$file])) {
$basenames[$theme_name][$group_name][$file] = backdrop_basename($file);
}
if ($basename === $basenames[$theme_name][$group_name][$file]) {
return $file;
}
}
}
}
if (isset($theme->base_theme)) {
return _color_get_file_path($filename, $theme->base_theme);
}
}