summaryrefslogtreecommitdiff
path: root/modules/simpletest/tests/form_test.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/simpletest/tests/form_test.module')
-rw-r--r--modules/simpletest/tests/form_test.module34
1 files changed, 34 insertions, 0 deletions
diff --git a/modules/simpletest/tests/form_test.module b/modules/simpletest/tests/form_test.module
index cbc4c0ead..64360f93f 100644
--- a/modules/simpletest/tests/form_test.module
+++ b/modules/simpletest/tests/form_test.module
@@ -153,6 +153,23 @@ function form_test_menu() {
);
}
+ $items['form-test/load-include-menu'] = array(
+ 'title' => 'FAPI test loading includes',
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array('form_test_load_include_menu'),
+ 'access callback' => TRUE,
+ 'file' => 'form_test.file.inc',
+ 'type' => MENU_CALLBACK,
+ );
+
+ $items['form-test/load-include-custom'] = array(
+ 'title' => 'FAPI test loading includes',
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array('form_test_load_include_custom'),
+ 'access callback' => TRUE,
+ 'type' => MENU_CALLBACK,
+ );
+
return $items;
}
@@ -1182,3 +1199,20 @@ function form_test_two_instances() {
$return['node_form_2'] = drupal_get_form('page_node_form', $node2);
return $return;
}
+
+/**
+ * Menu callback for testing custom form includes.
+ */
+function form_test_load_include_custom($form, &$form_state) {
+ $form['button'] = array(
+ '#type' => 'submit',
+ '#value' => t('Save'),
+ '#submit' => array('form_test_load_include_submit'),
+ );
+ // Specify the include file and enable form caching. That way the form is
+ // cached when it is submitted, but needs to find the specified submit handler
+ // in the include.
+ $form_state['build_info']['files'][] = array('module' => 'form_test', 'name' => 'form_test.file');
+ $form_state['cache'] = TRUE;
+ return $form;
+}