You are here

function globallink_submission_callback in GlobalLink Connect for Drupal 7.7

1 string reference to 'globallink_submission_callback'
globallink_menu in ./globallink.module
Implements hook_menu().

File

./globallink_send_translations.inc, line 1154

Code

function globallink_submission_callback($ajax) {
  module_load_include('inc', 'globallink', 'globallink_send_translations');
  if ($ajax) {
    ctools_include('ajax');
    ctools_include('modal');
    $form_state = array(
      'ajax' => TRUE,
      'title' => t('Create a Submission for GlobalLink'),
    );

    // Use ctools to generate ajax instructions for the browser to create
    // a form in a modal popup.
    $output = ctools_modal_form_wrapper('globallink_create_submission_form', $form_state);

    // If the form has been submitted, there may be additional instructions
    // such as dismissing the modal popup.
    if (!empty($form_state['executed']) && $form_state['executed']) {
      $commands = array();
      $commands[] = ctools_modal_command_dismiss();
    }

    // Return the ajax instructions to the browser via ajax_render().
    print ajax_render($output);
    drupal_exit();
  }
  else {
    return drupal_get_form('globallink_create_submission_form');
  }
}