Same name and namespace in other branches
  1. 4.6.x includes/theme.inc \list_themes()
  2. 4.7.x includes/theme.inc \list_themes()
  3. 6.x includes/theme.inc \list_themes()
  4. 7.x includes/theme.inc \list_themes()

Provides a list of currently available themes.

Parameters

$refresh: Whether to reload the list of themes from the database.

Return value

An array of the currently available themes.

5 calls to list_themes()
color_form_alter in modules/color/color.module
Implementation of hook_form_alter().
init_theme in includes/theme.inc
Initialize the theme system by loading the theme.
path_to_theme in includes/theme.inc
Return the path to the currently selected theme.
system_update_145 in modules/system/system.install
theme_get_setting in includes/theme.inc
Retrieve a setting for the current theme. This function is designed for use from within themes & engines to determine theme settings made in the admin interface.

File

includes/theme.inc, line 94
The theme system, which controls the output of Drupal.

Code

function list_themes($refresh = FALSE) {
  static $list;
  if ($refresh) {
    unset($list);
  }
  if (!$list) {
    $list = array();
    $result = db_query("SELECT * FROM {system} WHERE type = 'theme'");
    while ($theme = db_fetch_object($result)) {
      if (file_exists($theme->filename)) {
        $list[$theme->name] = $theme;
      }
    }
  }
  return $list;
}