| Versions | |
|---|---|
| 4.7 – 5 | system_themes() |
Menu callback; displays a listing of all themes.
modules/
<?php
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);
}
?>