function ajax_test_dialog_form

Form builder: Renders buttons with #ajax['dialog'].

1 string reference to 'ajax_test_dialog_form'
ajax_test_dialog in drupal/core/modules/system/tests/modules/ajax_test/ajax_test.module
Menu callback: Renders a form elements and links with #ajax['dialog'].

File

drupal/core/modules/system/tests/modules/ajax_test/ajax_test.module, line 171
Helper module for Ajax framework tests.

Code

function ajax_test_dialog_form($form, &$form_state) {

  // In order to use WebTestBase::drupalPostAJAX() to POST from a link, we need
  // to have a dummy field we can set in WebTestBase::drupalPost() else it won't
  // submit anything.
  $form['textfield'] = array(
    '#type' => 'hidden',
  );
  $form['button1'] = array(
    '#type' => 'submit',
    '#name' => 'button1',
    '#value' => 'Button 1 (modal)',
    '#ajax' => array(
      'callback' => 'ajax_test_dialog_form_callback_modal',
    ),
  );
  $form['button2'] = array(
    '#type' => 'submit',
    '#name' => 'button2',
    '#value' => 'Button 2 (non-modal)',
    '#ajax' => array(
      'callback' => 'ajax_test_dialog_form_callback_nonmodal',
    ),
  );
  return $form;
}