Form submit callback for the translation state update button.
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();
}
}