You are here

function globallink_file_entity_preview in GlobalLink Connect for Drupal 7.7

Helper function

1 string reference to 'globallink_file_entity_preview'
globallink_file_entity_menu in globallink_file_entity/globallink_file_entity.module
Implements hook_menu().

File

globallink_file_entity/globallink_file_entity_send.inc, line 331

Code

function globallink_file_entity_preview($ajax) {
  if ($ajax) {
    ctools_include('ajax');
    ctools_include('modal');
    $form_state = array(
      'ajax' => TRUE,
      'title' => t('Preview'),
    );

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

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

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