public function RedirectDeleteMultipleForm::buildForm in Redirect 8
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/ RedirectDeleteMultipleForm.php, line 110
Class
- RedirectDeleteMultipleForm
- Provides a redirect deletion confirmation form.
Namespace
Drupal\redirect\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$this->redirects = $this->privateTempStoreFactory
->get('redirect_multiple_delete_confirm')
->get($this->currentUser
->id());
if (empty($this->redirects)) {
return new RedirectResponse($this
->getCancelUrl()
->setAbsolute()
->toString());
}
$form['redirects'] = [
'#theme' => 'item_list',
'#items' => array_map(function ($redirect) {
return $redirect
->label();
}, $this->redirects),
];
return parent::buildForm($form, $form_state);
}