Same name and namespace in other branches
  1. 4.6.x modules/system.module \system_themes()
  2. 5.x modules/system/system.module \system_themes()

Menu callback; displays a listing of all themes.

1 call to system_themes()
system_update_156 in database/updates.inc
1 string reference to 'system_themes'
system_menu in modules/system.module
Implementation of hook_menu().

File

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

Code

function system_themes() {
  $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(
      '#type' => 'markup',
      '#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(
        '#type' => 'markup',
        '#value' => l(t('configure'), 'admin/themes/settings/' . $info->name),
      );
    }
    else {

      // Dummy element for form_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', 'bluemarine'),
  );
  $form['buttons']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save configuration'),
  );
  $form['buttons']['reset'] = array(
    '#type' => 'submit',
    '#value' => t('Reset to defaults'),
  );
  return drupal_get_form('system_themes', $form);
}