public function MessageMultipleDeleteForm::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 FormInterface::buildForm
File
- src/
Form/ MessageMultipleDeleteForm.php, line 65
Class
- MessageMultipleDeleteForm
- Class MessageMultipleDeleteForm.
Namespace
Drupal\message_ui\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
/** @var \Drupal\message\MessageTemplateInterface $templates */
$templates = $this->entityTypeManager
->getStorage('message_template')
->loadMultiple();
$options = [];
foreach ($templates as $template) {
$options[$template
->id()] = $template
->label();
}
$form['message_templates'] = [
'#type' => 'select',
'#title' => $this
->t('Message types'),
'#description' => $this
->t('Select which message templates you to delete at once'),
'#options' => $options,
'#size' => 5,
'#multiple' => TRUE,
];
$form['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Submit'),
];
return $form;
}