You are here

function lingotek_change_workflow in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.4 lingotek.bulk_grid.inc \lingotek_change_workflow()
  2. 7.5 lingotek.bulk_grid.inc \lingotek_change_workflow()
  3. 7.6 lingotek.bulk_grid.inc \lingotek_change_workflow()

Callback function to change workflow for multiple nodes at a time

Node IDs are passed through the $_SESSION variable at $_SESSION['lingotek_change_workflow']

Returns a fully rendered html form

1 string reference to 'lingotek_change_workflow'
lingotek_menu in ./lingotek.module
Implements hook_menu().

File

./lingotek.bulk_grid.inc, line 2969

Code

function lingotek_change_workflow($entity_type, $entity_ids) {
  $entity_ids = explode(',', $entity_ids);
  if ($entity_type === 'config') {
    foreach ($entity_ids as $entity_id) {
      LingotekConfigSet::getSetId($entity_id);
    }
    $entity_ids = LingotekSync::getSetIdsFromLids($entity_ids);
  }
  ctools_include('node.pages', 'node', '');
  ctools_include('modal');
  ctools_include('ajax');
  $form_state = array(
    'ajax' => TRUE,
    'entity_type' => $entity_type,
    'nids' => $entity_ids,
  );
  $output = ctools_modal_form_wrapper('lingotek_get_change_workflow_form', $form_state);
  if (!empty($form_state['executed'])) {

    // 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);
}