public function BaseTmgmtActionApproveForm::buildForm in TMGMT Extension Suite 8
Same name and namespace in other branches
- 8.3 src/Form/BaseTmgmtActionApproveForm.php \Drupal\tmgmt_extension_suit\Form\BaseTmgmtActionApproveForm::buildForm()
- 8.2 src/Form/BaseTmgmtActionApproveForm.php \Drupal\tmgmt_extension_suit\Form\BaseTmgmtActionApproveForm::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 ConfirmFormBase::buildForm
File
- src/
Form/ BaseTmgmtActionApproveForm.php, line 165
Class
- BaseTmgmtActionApproveForm
- Provides a confirmation form for sending multiple content entities.
Namespace
Drupal\tmgmt_extension_suit\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$temp_storage_name = $this
->getTempStorageName();
// Retrieve the content to be sent from the temp store.
$this->entityIds = $this->tempStoreFactory
->get($temp_storage_name)
->get($this
->currentUser()
->id());
if (!$this->entityIds) {
return new RedirectResponse($this
->getCancelUrl()
->setAbsolute()
->toString());
}
$entities = $this
->getEntities($this->entityIds);
// $form['batch'] = [
// '#type' => 'checkbox',
// '#title' => $this->t('Execute operation immediately'),
// '#default_value' => TRUE,
// ];
$items = [];
foreach ($entities as $entity) {
$items[$entity
->id()] = $entity
->label();
}
$form['items'] = [
'#theme' => 'item_list',
'#title' => $this
->t('Entities to process'),
'#items' => $items,
];
return ConfirmFormBase::buildForm($form, $form_state);
}