function bootstrap_get_theme_info in Express 8
Return information from the .info file of a theme (and possible base themes).
Parameters
string $theme_key: The machine name of the theme.
string $key: The key name of the item to return from the .info file. This value can include "][" to automatically attempt to traverse any arrays.
bool $base_themes: Recursively search base themes, defaults to TRUE.
Return value
string|array|false A string or array depending on the type of value and if a base theme also contains the same $key, FALSE if no $key is found.
Deprecated
Will be removed in a future release. There is no replacement.
File
- themes/
contrib/ bootstrap/ deprecated.php, line 733 - This contains deprecated functions that will be removed in a future release.
Code
function bootstrap_get_theme_info($theme_key = NULL, $key = NULL, $base_themes = TRUE) {
Bootstrap::deprecated();
// If no $theme_key is given, use the current theme if we can determine it.
if (!isset($theme_key)) {
$theme_key = !empty($GLOBALS['theme_key']) ? $GLOBALS['theme_key'] : FALSE;
}
if ($theme_key) {
$themes = \Drupal::service('theme_handler')
->listInfo();
if (!empty($themes[$theme_key])) {
$theme = $themes[$theme_key];
// If a key name was specified, return just that array.
if ($key) {
$value = FALSE;
// Recursively add base theme values.
if ($base_themes && isset($theme->base_themes)) {
foreach (array_keys($theme->base_themes) as $base_theme) {
$value = bootstrap_get_theme_info($base_theme, $key);
}
}
if (!empty($themes[$theme_key])) {
$info = $themes[$theme_key]->info;
// Allow array traversal.
$keys = explode('][', $key);
foreach ($keys as $parent) {
if (isset($info[$parent])) {
$info = $info[$parent];
}
else {
$info = FALSE;
}
}
if (is_array($value)) {
if (!empty($info)) {
if (!is_array($info)) {
$info = [
$info,
];
}
$value = NestedArray::mergeDeep($value, $info);
}
}
else {
if (!empty($info)) {
if (empty($value)) {
$value = $info;
}
else {
if (!is_array($value)) {
$value = [
$value,
];
}
if (!is_array($info)) {
$info = [
$info,
];
}
$value = NestedArray::mergeDeep($value, $info);
}
}
}
}
return $value;
}
// If no info $key was specified, just return the entire info array.
return $theme->info;
}
}
return FALSE;
}