public function LocalTaskItemForm::submitStatus in Translation Management Tool 8
Form submit callback for the translation state update button.
File
- translators/
tmgmt_local/ src/ Form/ LocalTaskItemForm.php, line 414
Class
- LocalTaskItemForm
- Form controller for the localTaskItem edit forms.
Namespace
Drupal\tmgmt_local\FormCode
public function submitStatus(array $form, FormStateInterface $form_state) {
$values = $form_state
->getValues();
/** @var \Drupal\tmgmt_local\Entity\LocalTaskItem $item */
$item = $this->entity;
$action = $form_state
->getTriggeringElement()['#tmgmt_local_action'];
$key = $form_state
->getTriggeringElement()['#tmgmt_local_key'];
// Write the translated data into the job item.
if (isset($values[$key]) && is_array($values[$key]) && isset($values[$key]['translation'])) {
$update['#status'] = $action == 'finish' ? TMGMT_DATA_ITEM_STATE_TRANSLATED : TMGMT_DATA_ITEM_STATE_UNTRANSLATED;
$item
->updateData($key, $update);
$item
->save();
// We need to rebuild form so we get updated action button state.
$form_state
->setRebuild();
}
}