You are here

public function TMGMTI18nStringDefaultSourceUIController::overviewFormSubmit in Translation Management Tool 7

Overrides TMGMTDefaultSourceUIController::overviewFormSubmit

File

sources/i18n_string/tmgmt_i18n_string.ui.inc, line 245
Provides the I18nString source controller.

Class

TMGMTI18nStringDefaultSourceUIController
Class TMGMTI18nStringDefaultSourceUIController

Code

public function overviewFormSubmit($form, &$form_state, $type) {

  // Handle search redirect.
  $this
    ->overviewSearchFormRedirect($form, $form_state, $type);
  $items = array_filter($form_state['values']['items']);
  $type = $form_state['item_type'];
  $source_lang = variable_get_value('i18n_string_source_language');

  // Create only single job for all items as the source language is just
  // the same for all.
  $job = tmgmt_job_create($source_lang, NULL, $GLOBALS['user']->uid);

  // Loop through entities and create individual jobs for each source language.
  foreach ($items as $item) {
    $job
      ->addItem('i18n_string', $type, $item);
  }
  $form_state['redirect'] = array(
    'admin/tmgmt/jobs/' . $job->tjid,
    array(
      'query' => array(
        'destination' => current_path(),
      ),
    ),
  );
  drupal_set_message(t('One job needs to be checked out.'));
}