You are here

public function TMGMTLocaleSourceUIController::overviewFormSubmit in Translation Management Tool 7

Implements TMGMTSourceUIControllerInterface::overviewFormSubmit().

Overrides TMGMTDefaultSourceUIController::overviewFormSubmit

File

sources/locale/tmgmt_locale.ui.inc, line 267
Provides the I18nString source controller.

Class

TMGMTLocaleSourceUIController
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 = 'en';

  // 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('locale', $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.'));
}