You are here

function lingotek_popup in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.5 lingotek.bulk_grid.inc \lingotek_popup()
  2. 7.6 lingotek.bulk_grid.inc \lingotek_popup()
1 string reference to 'lingotek_popup'
lingotek_menu in ./lingotek.module
Implements hook_menu().

File

./lingotek.bulk_grid.inc, line 507

Code

function lingotek_popup($form_id, $entity_type = 'node', $entity_ids = array(), $extra = "") {
  ctools_include('node.pages', 'node', '');
  ctools_include('modal');
  ctools_include('ajax');
  $entity_ids = !is_array($entity_ids) ? explode(',', $entity_ids) : $entity_ids;
  $form_state = array(
    'ajax' => TRUE,
    'entity_ids' => $entity_ids,
    'entity_type' => $entity_type,
  );
  $output = ctools_modal_form_wrapper('lingotek_' . $form_id . '_form', $form_state);
  if (!empty($form_state['executed'])) {
    lingotek_grid_action_submit(NULL, $form_state);

    // Create ajax command array, dismiss the modal window.
    $commands = array();
    $commands[] = ctools_modal_command_dismiss();
    $commands[] = ctools_ajax_command_reload();
    print ajax_render($commands);
    drupal_exit();
  }
  print ajax_render($output);
}