public function LocalTaskItemForm::preview in Translation Management Tool 8
Form submit callback for the preview button.
File
- translators/
tmgmt_local/ src/ Form/ LocalTaskItemForm.php, line 466
Class
- LocalTaskItemForm
- Form controller for the localTaskItem edit forms.
Namespace
Drupal\tmgmt_local\FormCode
public function preview(array $form, FormStateInterface $form_state) {
$task_item = $this->entity;
$job_item = $task_item
->getJobItem();
$job_item
->addTranslatedData($this
->prepareData($task_item
->getData()), [], TMGMT_DATA_ITEM_STATE_PRELIMINARY);
/** @var \Drupal\Core\Url $url */
$url = $job_item
->getSourcePlugin()
->getPreviewUrl($job_item);
$form_state
->setRedirectUrl($url);
}