You are here

function ctools_automodal_get_page in CTools Auto-modal 7

Display a normal Drupal page using CTools modal.

1 string reference to 'ctools_automodal_get_page'
ctools_automodal_menu_alter in ./ctools_automodal.module
Implements hook_menu_alter().

File

./ctools_automodal.module, line 147

Code

function ctools_automodal_get_page() {
  $args = func_get_args();
  $callback = array_shift($args);
  $ajax = array_pop($args);
  ctools_automodal_fix_get_q();
  if (function_exists($callback)) {
    $output = call_user_func_array($callback, $args);
    if ($ajax) {
      ctools_include('modal');
      ctools_include('ajax');
      $commands = ctools_automodal_page_render($output);
      if (empty($commands)) {
        $commands[] = ctools_modal_command_loading();
        if (!empty($_GET['destination'])) {
          $commands[] = ctools_ajax_command_redirect($_GET['destination']);
        }
      }
      print ajax_render($commands);
      exit;
    }
    else {
      return $output;
    }
  }
  else {
    return MENU_NOT_FOUND;
  }
}