function admin_theme_form_alter in Administration theme 5
Implementation of hook_form_alter().
File
- ./
admin_theme.module, line 53 - Enable the administration theme on more pages then possible with Drupal's default administration page.
Code
function admin_theme_form_alter($form_id, &$form) {
if ($form_id == 'system_admin_theme_settings') {
// we want our checkboxes before the submit button
$form['buttons']['#weight'] = 10;
// define a fieldset for the theme
$form['theme'] = array(
'#type' => 'fieldset',
'#title' => t('Theme'),
'#collapsible' => TRUE,
);
$form['theme']['#description'] = $form['admin_theme']['#description'];
unset($form['admin_theme']['#description']);
// add the core administration theme select field to this fieldset
$form['theme']['admin_theme'] = $form['admin_theme'];
unset($form['admin_theme']);
// define a fieldset for the page selection
$form['pages'] = array(
'#type' => 'fieldset',
'#title' => t('Pages'),
'#collapsible' => TRUE,
'#description' => t('Choose which pages should be displayed with the administration theme.'),
);
// add all options as checkboxes to the admin theme settings form
$list = admin_theme_list();
foreach ($list as $info) {
$var = admin_theme_variable_name($info['module'], $info['option']);
$form['pages'][$var] = array(
'#type' => 'checkbox',
'#title' => array_key_exists('title', $info) ? $info['title'] : NULL,
'#description' => array_key_exists('description', $info) ? $info['description'] : NULL,
'#default_value' => variable_get($var, '0'),
);
}
// allow the user to define a set of pages where the admin theme should or should not be applied to
$form['pages']['custom'] = array(
'#type' => 'fieldset',
'#title' => t('Custom pages'),
'#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array(
'%blog' => 'blog',
'%blog-wildcard' => 'blog/*',
'%front' => '<front>',
)),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#weight' => 9,
);
$form['pages']['custom']['admin_theme_path'] = array(
'#type' => 'textarea',
'#title' => t('Use administration theme on the following pages'),
'#default_value' => variable_get('admin_theme_path', ''),
);
$form['pages']['custom']['admin_theme_path_disallow'] = array(
'#type' => 'textarea',
'#title' => t('Do not use administration theme on the following pages'),
'#description' => t('If a path appears here, the administration theme is not shown even if all above options apply.'),
'#default_value' => variable_get('admin_theme_path_disallow', ''),
);
}
}