You are here

function tmgmt_ui_translation_review_form_revert in Translation Management Tool 7

Review form revert action callback.

1 string reference to 'tmgmt_ui_translation_review_form_revert'
_tmgmt_ui_review_form_element in ui/tmgmt_ui.module
Build form elements for the review form using flatened data items.

File

ui/tmgmt_ui.module, line 850
Common Translation managment UI.

Code

function tmgmt_ui_translation_review_form_revert($form, &$form_state) {

  /** @var TMGMTJobItem $item */
  $item = $form_state['item'];
  $key = tmgmt_ensure_keys_array($form_state['triggering_element']['#data_item_key']);
  if ($item
    ->dataItemRevert($key)) {

    // Update the form_state input values so that the new default vale will be
    // shown.
    $form_key = str_replace('][', '|', $form_state['triggering_element']['#data_item_key']);
    unset($form_state['input'][$form_key]['translation']);
    $item
      ->save();
  }
  else {
    drupal_set_message(t('No past revision found, translation was not reverted.'), 'warning');
  }
  $form_state['rebuild'] = TRUE;
}