function tmgmt_translation_review_form_reject_confirm in Translation Management Tool 8
Form callback for the reject confirm form.
File
- ./
tmgmt.module, line 833 - Main module file for the Translation Management module.
Code
function tmgmt_translation_review_form_reject_confirm(array $form, FormStateInterface $form_state, JobItemInterface $job_item, $key) {
// Path of job item review form.
$path = explode('/', Url::fromRoute('<current>')
->getInternalPath());
$path = implode('/', array_slice($path, 0, count($path) - 2));
$args = array(
'@data_item' => $job_item
->getData(\Drupal::service('tmgmt.data')
->ensureArrayKey($key), '#label'),
'@job_item' => $job_item
->label(),
);
$form = confirm_form($form, t('Confirm rejection of @data_item in @job_item', $args), $path, '');
$form_state
->set('item', $job_item);
$form['key'] = array(
'#type' => 'value',
'#value' => $key,
);
$form['actions']['submit']['#name'] = 'reject-' . $key;
$form['actions']['submit']['#submit'] = array(
'tmgmt_translation_review_form_update_state',
);
$form = $job_item
->getTranslatorPlugin()
->rejectForm($form, $form_state);
return $form;
}