public function LocalTranslatorUi::checkoutSettingsForm

Form callback for the checkout settings form.

Overrides TranslatorPluginUiBase::checkoutSettingsForm

File

translators/tmgmt_local/src/LocalTranslatorUi.php, line 19

Class

LocalTranslatorUi
Drupal user provider plugin UI.

Namespace

Drupal\tmgmt_local

Code

public function checkoutSettingsForm(array $form, FormStateInterface $form_state, JobInterface $job) {
  if ($translators = tmgmt_local_assignees($job
    ->getSourceLangcode(), array(
    $job
      ->getTargetLangcode(),
  ))) {
    $form['translator'] = array(
      '#title' => t('Assign job to'),
      '#type' => 'select',
      '#options' => array(
        '' => t('- Select user -'),
      ) + $translators,
      '#default_value' => $job
        ->getSetting('translator'),
    );
  }
  else {
    $form['message'] = array(
      '#markup' => t('There are no users available to assign.'),
    );
  }
  $form['job_comment'] = array(
    '#type' => 'textarea',
    '#title' => t('Comment for the translation'),
    '#description' => t('You can provide a comment so that the assigned user will better understand your requirements.'),
    '#default_value' => $job
      ->getSetting('job_comment'),
  );
  return $form;
}