system_themes

5 system.module system_themes()

Menu callback; displays a listing of all themes.

1 call to system_themes()

2 string references to 'system_themes'

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;
}
Login or register to post comments