| Drupal | PHP Cross Reference | Content Management Systems |
1 <?php 2 3 /** 4 * @file 5 * An include file to test loading it with the form API. 6 */ 7 8 /** 9 * Form constructor for testing FAPI file inclusion of the file specified in 10 * hook_menu(). 11 */ 12 function form_test_load_include_menu($form, &$form_state) { 13 // Submit the form via Ajax. That way the FAPI has to care about including 14 // the file specified in hook_menu(). 15 $ajax_wrapper_id = drupal_html_id('form-test-load-include-menu-ajax-wrapper'); 16 $form['ajax_wrapper'] = array( 17 '#markup' => '<div id="' . $ajax_wrapper_id . '"></div>', 18 ); 19 $form['button'] = array( 20 '#type' => 'submit', 21 '#value' => t('Save'), 22 '#submit' => array('form_test_load_include_submit'), 23 '#ajax' => array( 24 'wrapper' => $ajax_wrapper_id, 25 'method' => 'append', 26 'callback' => 'form_test_load_include_menu_ajax', 27 ), 28 ); 29 return $form; 30 } 31 32 /** 33 * Submit callback for the form API file inclusion test forms. 34 */ 35 function form_test_load_include_submit($form, $form_state) { 36 drupal_set_message('Submit callback called.'); 37 } 38 39 /** 40 * Ajax callback for the file inclusion via menu test. 41 */ 42 function form_test_load_include_menu_ajax($form) { 43 // We don't need to return anything, since #ajax['method'] is 'append', which 44 // does not remove the original #ajax['wrapper'] element, and status messages 45 // are automatically added by the Ajax framework as long as there's a wrapper 46 // element to add them to. 47 return ''; 48 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
title