protected function actions(array $form, FormStateInterface $form_state) {
$job = $this->entity;
$actions['save'] = array(
'#type' => 'submit',
'#value' => t('Save job'),
'#submit' => array(
'::submitForm',
'::save',
),
'#weight' => 5,
);
if (!$job
->isUnprocessed()) {
$actions['save']['#button_type'] = 'primary';
}
if (!$job
->isContinuous() && $job
->access('submit')) {
$actions['submit'] = array(
'#type' => 'submit',
'#button_type' => 'primary',
'#value' => $this->jobQueue
->count() <= 1 ? t('Submit to provider') : t('Submit to provider and continue'),
'#access' => $job
->isSubmittable(),
'#disabled' => !$job
->getTranslatorId(),
'#submit' => array(
'::submitForm',
'::save',
),
'#weight' => 0,
);
$actions['resubmit_job'] = array(
'#type' => 'submit',
'#submit' => array(
'tmgmt_submit_redirect',
),
'#redirect' => 'admin/tmgmt/jobs/' . $job
->id() . '/resubmit',
'#value' => t('Resubmit'),
'#access' => $job
->isAborted(),
'#weight' => 10,
);
$actions['abort_job'] = array(
'#type' => 'submit',
'#value' => t('Abort job'),
'#redirect' => 'admin/tmgmt/jobs/' . $job
->id() . '/abort',
'#submit' => array(
'tmgmt_submit_redirect',
),
'#access' => $job
->isAbortable(),
'#weight' => 15,
);
}
else {
$actions['save']['#button_type'] = 'primary';
}
if (!$job
->isNew()) {
$actions['delete'] = array(
'#type' => 'submit',
'#value' => t('Delete'),
'#submit' => array(
'tmgmt_submit_redirect',
),
'#redirect' => 'admin/tmgmt/jobs/' . $job
->id() . '/delete',
// Don't run validations, so the user can always delete the job.
'#limit_validation_errors' => array(),
);
}
return $actions;
}