admin.theme.inc 924 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Theme switcher admin block.
  4. */
  5. function admin_block_theme() {
  6. $themes = list_themes();
  7. if (count($themes) > 2) {
  8. return array(
  9. 'subject' => t('Switch theme'),
  10. 'content' => drupal_get_form('admin_block_theme_form', $themes),
  11. );
  12. }
  13. }
  14. /**
  15. * Devel admin block form.
  16. */
  17. function admin_block_theme_form($form, $form_state, $themes) {
  18. $options = array();
  19. foreach ($themes as $theme) {
  20. if ($theme->status) {
  21. $options[$theme->name] = isset($theme->info['name']) ? check_plain($theme->info['name']) : $theme->name;
  22. }
  23. }
  24. $form = array();
  25. $form['theme_default'] = array(
  26. '#type' => 'radios',
  27. '#options' => $options,
  28. '#default_value' => variable_get('theme_default', 'garland'),
  29. );
  30. $form['submit'] = array(
  31. '#type' => 'submit',
  32. '#value' => t('Save configuration'),
  33. );
  34. $form['#submit'] = array('system_settings_form_submit');
  35. return $form;
  36. }