You are here

function themekey_theme_options in ThemeKey 7.2

Same name and namespace in other branches
  1. 6.4 themekey_build.inc \themekey_theme_options()
  2. 6.2 themekey_build.inc \themekey_theme_options()
  3. 6.3 themekey_build.inc \themekey_theme_options()
  4. 7.3 themekey_build.inc \themekey_theme_options()
  5. 7 themekey_build.inc \themekey_theme_options()

Creates options array for a theme select box.

Example: $form['theme'] = array( '#type' => 'select', '#title' => t('Theme'), '#options' => themekey_theme_options(), );

Parameters

$default: Boolean to indicate if options array should contain 'System default' theme. Default is TRUE.

$admin: Boolean to indicate if options array should contain 'Administration theme'. Default is FALSE.

Return value

options array for a theme select box

2 calls to themekey_theme_options()
themekey_rule_chain_form in ./themekey_admin.inc
Form builder for the rule chain.
themekey_ui_theme_build_select_form in ./themekey_ui_admin.inc
Internal function to add a theme selector to a form.

File

./themekey_build.inc, line 36
The functions in this file are the back end of ThemeKey which should be used only if you configure something, but not when ThemeKey switches themes.

Code

function themekey_theme_options($default = TRUE, $admin = FALSE) {
  $themes = list_themes();
  ksort($themes);
  $options_themes = array();
  if ($default) {
    $options_themes['default'] = '=> ' . t('System default');
  }
  foreach ($themes as $theme) {
    if ($theme->status || variable_get('themekey_allthemes', 0)) {
      $options_themes[$theme->name] = $theme->info['name'];
    }
  }
  if ($admin) {
    $options_themes['ThemeKeyAdminTheme'] = '=> ' . t('Administration theme');
  }
  return $options_themes;
}