You are here

function autodialog_deliver in Auto-Dialog 7

Autodialog delivery callback.

1 string reference to 'autodialog_deliver'
autodialog_page_delivery_callback_alter in ./autodialog.module
Implements hook_page_delivery_callback_alter().

File

./autodialog.module, line 33

Code

function autodialog_deliver($page_callback_result) {
  $dialog_options = isset($_POST['autodialog_options']) ? $_POST['autodialog_options'] : array();
  $content = '';
  if (is_int($page_callback_result)) {
    switch ($page_callback_result) {
      case MENU_NOT_FOUND:
        $content = t('The requested page could not be found.');
        break;
      case MENU_ACCESS_DENIED:
        $content = t('You are not authorized to access this page.');
        break;
      case MENU_SITE_OFFLINE:
        $content = filter_xss_admin(variable_get('maintenance_mode_message', t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array(
          '@site' => variable_get('site_name', 'Drupal'),
        ))));
        break;
    }
  }
  else {
    $content = drupal_render_page($page_callback_result);
    if ($messages = theme('status_messages')) {
      $content = $messages . $content;
    }
  }
  $commands = array(
    ajax_command_autodialog(drupal_get_title(), $content, $dialog_options, check_plain($_POST['autodialog_link_id']) . '-dialog'),
  );
  drupal_alter('autodialog_commands', $commands);
  ajax_deliver(array(
    '#type' => 'ajax',
    '#commands' => $commands,
  ));
}