public function LingotekJobAssignToMultipleEntitiesForm::buildForm in Lingotek Translation 8.2
Same name and namespace in other branches
- 4.0.x src/Form/LingotekJobAssignToMultipleEntitiesForm.php \Drupal\lingotek\Form\LingotekJobAssignToMultipleEntitiesForm::buildForm()
- 3.0.x src/Form/LingotekJobAssignToMultipleEntitiesForm.php \Drupal\lingotek\Form\LingotekJobAssignToMultipleEntitiesForm::buildForm()
- 3.1.x src/Form/LingotekJobAssignToMultipleEntitiesForm.php \Drupal\lingotek\Form\LingotekJobAssignToMultipleEntitiesForm::buildForm()
- 3.2.x src/Form/LingotekJobAssignToMultipleEntitiesForm.php \Drupal\lingotek\Form\LingotekJobAssignToMultipleEntitiesForm::buildForm()
- 3.3.x src/Form/LingotekJobAssignToMultipleEntitiesForm.php \Drupal\lingotek\Form\LingotekJobAssignToMultipleEntitiesForm::buildForm()
- 3.4.x src/Form/LingotekJobAssignToMultipleEntitiesForm.php \Drupal\lingotek\Form\LingotekJobAssignToMultipleEntitiesForm::buildForm()
- 3.5.x src/Form/LingotekJobAssignToMultipleEntitiesForm.php \Drupal\lingotek\Form\LingotekJobAssignToMultipleEntitiesForm::buildForm()
- 3.6.x src/Form/LingotekJobAssignToMultipleEntitiesForm.php \Drupal\lingotek\Form\LingotekJobAssignToMultipleEntitiesForm::buildForm()
- 3.7.x src/Form/LingotekJobAssignToMultipleEntitiesForm.php \Drupal\lingotek\Form\LingotekJobAssignToMultipleEntitiesForm::buildForm()
- 3.8.x src/Form/LingotekJobAssignToMultipleEntitiesForm.php \Drupal\lingotek\Form\LingotekJobAssignToMultipleEntitiesForm::buildForm()
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides FormInterface::buildForm
1 call to LingotekJobAssignToMultipleEntitiesForm::buildForm()
- LingotekJobClearMultipleEntitiesForm::buildForm in src/
Form/ LingotekJobClearMultipleEntitiesForm.php - Form constructor.
1 method overrides LingotekJobAssignToMultipleEntitiesForm::buildForm()
- LingotekJobClearMultipleEntitiesForm::buildForm in src/
Form/ LingotekJobClearMultipleEntitiesForm.php - Form constructor.
File
- src/
Form/ LingotekJobAssignToMultipleEntitiesForm.php, line 113
Class
- LingotekJobAssignToMultipleEntitiesForm
- Form for bulk assignation of Job ID to content entities.
Namespace
Drupal\lingotek\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$this->selection = $this->tempStore
->get($this->currentUser
->id());
if (empty($this->selection)) {
$form_state
->setRedirectUrl(Url::fromUserInput('/' . $form_state
->getValue('destination')));
}
$entities = $this
->getSelectedEntities($this->selection);
$items = array_map(function ($entity) {
return $entity
->label();
}, $entities);
$form['job_id'] = [
'#type' => 'lingotek_job_id',
'#title' => $this
->t('Job ID'),
'#description' => $this
->t('Assign a job id that you can filter on later on the TMS or in this page.'),
];
$form['update_tms'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Notify the Lingotek TMS'),
'#description' => $this
->t('Notify the Lingotek TMS (when applicable)'),
];
$form['entities'] = [
'#theme' => 'item_list',
'#title' => $this
->t('Affected content'),
'#items' => $items,
];
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Assign Job ID'),
'#submit' => [
'::submitForm',
],
'#button_type' => 'primary',
];
$form['actions']['cancel'] = [
'#type' => 'submit',
'#value' => $this
->t('Cancel'),
'#submit' => [
'::cancelForm',
],
'#attributes' => [
'class' => [
'button',
],
],
];
return $form;
}