public function DeleteMultiple::buildForm in Message UI 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/ DeleteMultiple.php, line 96
Class
- DeleteMultiple
- Provides a message deletion confirmation form.
Namespace
Drupal\message_ui\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
// @todo - below is from Message module, remove?
$this->messages = $this->tempStoreFactory
->get('message_multiple_delete_confirm')
->get(\Drupal::currentUser()
->id());
if (empty($this->messages)) {
return new RedirectResponse($this
->getCancelUrl()
->setAbsolute()
->toString());
}
$form['messages'] = [
'#theme' => 'item_list',
'#items' => array_map([
$this,
'filterCallback',
], $this->messages),
];
$form = parent::buildForm($form, $form_state);
$form['actions']['cancel']['#href'] = $this
->getCancelRoute();
// @todo - See "Delete multiple messages" from message_ui in D7.
return $form;
}