You are here

function system_themes in Drupal 5

Same name and namespace in other branches
  1. 4 modules/system.module \system_themes()

Menu callback; displays a listing of all themes.

1 call to system_themes()
system_update_156 in modules/system/system.install
2 string references to 'system_themes'
color_form_alter in modules/color/color.module
Implementation of hook_form_alter().
system_menu in modules/system/system.module
Implementation of hook_menu().

File

modules/system/system.module, line 1142
Configuration system that lets administrators modify the workings of the site.

Code

function system_themes() {
  drupal_clear_css_cache();
  $themes = system_theme_data();
  ksort($themes);
  foreach ($themes as $info) {
    $info->screenshot = dirname($info->filename) . '/screenshot.png';
    $screenshot = file_exists($info->screenshot) ? theme('image', $info->screenshot, t('Screenshot for %theme theme', array(
      '%theme' => $info->name,
    )), '', array(
      'class' => 'screenshot',
    ), FALSE) : t('no screenshot');
    $form[$info->name]['screenshot'] = array(
      '#value' => $screenshot,
    );
    $form[$info->name]['description'] = array(
      '#type' => 'item',
      '#title' => $info->name,
      '#value' => dirname($info->filename),
    );
    $options[$info->name] = '';
    if ($info->status) {
      $status[] = $info->name;
    }
    if ($info->status && (function_exists($info->prefix . '_settings') || function_exists($info->prefix . '_features'))) {
      $form[$info->name]['operations'] = array(
        '#value' => l(t('configure'), 'admin/build/themes/settings/' . $info->name),
      );
    }
    else {

      // Dummy element for drupal_render. Cleaner than adding a check in the theme function.
      $form[$info->name]['operations'] = array();
    }
  }
  $form['status'] = array(
    '#type' => 'checkboxes',
    '#options' => $options,
    '#default_value' => $status,
  );
  $form['theme_default'] = array(
    '#type' => 'radios',
    '#options' => $options,
    '#default_value' => variable_get('theme_default', 'garland'),
  );
  $form['buttons']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save configuration'),
  );
  $form['buttons']['reset'] = array(
    '#type' => 'submit',
    '#value' => t('Reset to defaults'),
  );
  return $form;
}