Either list_themes() and system_rebuild_theme_data() shouldn't be two separate functions, or system_rebuild_theme_data() shouldn't be returning a theme list.
The data they return is quite similar (both primarily rely on _system_rebuild_theme_data), and in the same nested array, keyed by theme name, format:
- filename, name, weight, schema_version, status, type, owner (path to engine), and the entire info array (including regions, stylesheets, scripts, settings, overlay regions...) are all identical.
- system_rebuild_theme_data() has a template boolean, prefix (phptemplate), and a uri (which is the same as the filename).
- list_themes() has bootstrap (always a zero, for what i've seen) and engine (phptemplate).
Flagging this developer experience issue for early fixing in Drupal 8.
#783580: what's the point of _system_theme_list()? - this issue actually fixed it by using list_themes(), but a later change put system_rebuild_theme_data() in instead.
#761608: Missing theme settings values because list_themes() has inconsistent theme object data - JohnAlbin mentions the mess of functions we have to list themes.
#925490: list_themes() should not call file_exists() on each theme's info file - a valid difference between them, but still doesn't account for two having the listing functionality in two places
When D7 is out we should mention this issue in those issues to get the right eyes on it for D8.
Comments
Comment #1
catchSubscribing.
Comment #2
greg.harveyThis may or may not be related: #1058198: We do not need to call _system_theme_data() when the database is not available
Comment #3
ianthomas_ukThese have now been moved to \Drupal\Core\Extension\ThemeHandler::listInfo() and ThemeHandler::rebuildThemeData() but I don't think the DX has changed.