Form builder: Renders buttons with #ajax['dialog'].
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;
}