You are here

function xmlsitemap_modal_get_form in XML sitemap 7.2

Same name and namespace in other branches
  1. 6.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 24
Main file for XML sitemap Modal.

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,
      'build_info' => array(
        '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']);
      }
    }
    print ajax_render($commands);
    drupal_exit();
  }
  else {
    array_unshift($args, $form_id);
    return call_user_func_array('drupal_get_form', $args);
  }
}