Rebuild, save, and return data about all currently available themes.
Array of all available themes and their data.
function system_rebuild_theme_data() {
$themes = _system_rebuild_theme_data();
ksort($themes);
// @todo This function has no business in determining/setting the status of
// a theme, but various other functions expect it to return themes with a
// $status property. system_list() stores the return value of this function
// in state, and ensures to set/override the $status property for each theme
// based on the current config. Remove this code when themes have a proper
// installation status.
// @see http://drupal.org/node/1067408
$enabled_themes = (array) config('system.theme')
->get('enabled');
$files = array();
foreach ($themes as $name => $theme) {
$theme->status = (int) isset($enabled_themes[$name]);
$files[$name] = $theme->filename;
}
// Replace last known theme data state.
// @todo Obsolete with proper installation status for themes.
state()
->set('system.theme.data', $themes);
// Store filenames to allow system_list() and drupal_get_filename() to
// retrieve them without having to rebuild or scan the filesystem.
state()
->set('system.theme.files', $files);
return $themes;
}