system_themes_form
modules/system/system.admin.inc, строка 187
- Версии
- 6
system_themes_form()
Связанные темы
Код
<?php
function system_themes_form() {
drupal_clear_css_cache();
$themes = system_theme_data();
uasort($themes, 'system_sort_modules_by_info_name');
$status = array();
$incompatible_core = array();
$incompatible_php = array();
foreach ($themes as $theme) {
$screenshot = NULL;
$theme_key = $theme->name;
while ($theme_key) {
if (file_exists($themes[$theme_key]->info['screenshot'])) {
$screenshot = $themes[$theme_key]->info['screenshot'];
break;
}
$theme_key = isset($themes[$theme_key]->info['base theme']) ? $themes[$theme_key]->info['base theme'] : NULL;
}
$screenshot = $screenshot ? theme('image', $screenshot, t('Screenshot for %theme theme', array('%theme' => $theme->info['name'])), '', array('class' => 'screenshot'), FALSE) : t('no screenshot');
$form[$theme->name]['screenshot'] = array('#value' => $screenshot);
$form[$theme->name]['info'] = array(
'#type' => 'value',
'#value' => $theme->info,
);
$options[$theme->name] = '';
if (!empty($theme->status) || $theme->name == variable_get('admin_theme', '0')) {
$form[$theme->name]['operations'] = array('#value' => l(t('configure'), 'admin/build/themes/settings/'. $theme->name) );
}
else {
// Dummy element for drupal_render. Cleaner than adding a check in the theme function.
$form[$theme->name]['operations'] = array();
}
if (!empty($theme->status)) {
$status[] = $theme->name;
}
else {
// Ensure this theme is compatible with this version of core.
if (!isset($theme->info['core']) || $theme->info['core'] != DRUPAL_CORE_COMPATIBILITY) {
$incompatible_core[] = $theme->name;
}
if (version_compare(phpversion(), $theme->info['php']) < 0) {
$incompatible_php[$theme->name] = $theme->info['php'];
}
}
}
$form['status'] = array(
'#type' => 'checkboxes',
'#options' => $options,
'#default_value' => $status,
'#incompatible_themes_core' => drupal_map_assoc($incompatible_core),
'#incompatible_themes_php' => $incompatible_php,
);
$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;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии