summaryrefslogtreecommitdiff
path: root/modules/simpletest/tests/form_test.file.inc
blob: 96681eaa8086b97039ae8067a7b48b92391dd108 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
// $Id$

/**
 * @file
 * An include file to test loading it with the form API.
 */

/**
 * Form constructor for testing FAPI file inclusion of the file specified in
 * hook_menu().
 */
function form_test_load_include_menu($form, &$form_state) {
  // Submit the form via AJAX. That way the FAPI has to care about including
  // the file specified in hook_menu().
  $form['button'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
    '#submit' => array('form_test_load_include_submit'),
    '#ajax' => array(
      'callback' => 'form_test_load_include_menu_ajax',
    ),
  );
  return $form;
}

/**
 * Submit callback for the form API file inclusion test forms.
 */
function form_test_load_include_submit($form, $form_state) {
  drupal_set_message('Submit callback called.');
}

/**
 * Ajax callback for the file inclusion via menu test. We don't need to return
 * anything as the messages are added automatically.
 */
function form_test_load_include_menu_ajax($form) {
  return '';
}