You are here

function xmlsitemap_modal_get_form in XML sitemap 6.2

Same name and namespace in other branches
  1. 7.2 xmlsitemap_modal/xmlsitemap_modal.module \xmlsitemap_modal_get_form()

Display a Drupal form using CTools modal or normal page display.

1 string reference to 'xmlsitemap_modal_get_form'
xmlsitemap_modal_menu_alter in xmlsitemap_modal/xmlsitemap_modal.module
Implements hook_menu_alter().

File

xmlsitemap_modal/xmlsitemap_modal.module, line 19

Code

function xmlsitemap_modal_get_form() {
  $args = func_get_args();
  $form_id = array_shift($args);
  $ajax = array_pop($args);
  if ($ajax) {
    ctools_include('ajax');
    ctools_include('modal');
    $form_state = array(
      'ajax' => TRUE,
      'args' => $args,
    );
    $commands = ctools_modal_form_wrapper($form_id, $form_state);
    if (empty($commands)) {
      $commands[] = ctools_modal_command_loading();
      if (!empty($_GET['destination'])) {
        $commands[] = ctools_ajax_command_redirect($_GET['destination']);
      }
    }
    return ctools_ajax_render($commands);
  }
  else {
    array_unshift($args, $form_id);
    return call_user_func_array('drupal_get_form', $args);
  }
}