function _ajax_test_dialog

Util to render dialog in ajax callback.

Parameters

bool $is_modal: (optional) TRUE if modal, FALSE if plain dialog. Defaults to FALSE.

2 calls to _ajax_test_dialog()
ajax_test_dialog_form_callback_modal in drupal/core/modules/system/tests/modules/ajax_test/ajax_test.module
AJAX callback handler for ajax_test_dialog_form().
ajax_test_dialog_form_callback_nonmodal in drupal/core/modules/system/tests/modules/ajax_test/ajax_test.module
AJAX callback handler for ajax_test_dialog_form().

File

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

Code

function _ajax_test_dialog($is_modal = FALSE) {
  $content = ajax_test_dialog_contents();
  $response = new AjaxResponse();
  $title = t('AJAX Dialog contents');
  $html = drupal_render($content);
  if ($is_modal) {
    $response
      ->addCommand(new OpenModalDialogCommand($title, $html));
  }
  else {
    $selector = '#ajax-test-dialog-wrapper-1';
    $response
      ->addCommand(new OpenDialogCommand($selector, $title, $html));
  }
  return $response;
}