theme-settings.php 921 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * @file
  4. * Theme setting callbacks for the test_theme theme.
  5. */
  6. /**
  7. * Implements hook_form_FORM_ID_alter().
  8. */
  9. function test_theme_form_system_theme_settings_alter(&$form, &$form_state) {
  10. $form['test_theme_checkbox'] = array(
  11. '#type' => 'checkbox',
  12. '#title' => 'Test theme checkbox',
  13. '#default_value' => theme_get_setting('test_theme_checkbox'),
  14. );
  15. // Force the form to be cached so we can test that this file is properly
  16. // loaded and the custom submit handler is properly called even on a cached
  17. // form build.
  18. $form_state['cache'] = TRUE;
  19. $form['#submit'][] = 'test_theme_form_system_theme_settings_submit';
  20. }
  21. /**
  22. * Form submission handler for the test theme settings form.
  23. *
  24. * @see test_theme_form_system_theme_settings_alter()
  25. */
  26. function test_theme_form_system_theme_settings_submit($form, &$form_state) {
  27. drupal_set_message('The test theme setting was saved.');
  28. }