public function FileDeleteMultipleForm::buildForm in File Entity (fieldable files) 8.2
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/ FileDeleteMultipleForm.php, line 100
Class
- FileDeleteMultipleForm
- Provides a file deletion confirmation form.
Namespace
Drupal\file_entity\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$this->files = $this->tempStore
->get('delete');
if (empty($this->files)) {
$form_state
->setRedirect('entity.file.collection');
}
$form['files'] = array(
'#theme' => 'item_list',
'#items' => array_map(function (FileInterface $file) {
return Html::escape($file
->label());
}, $this->files),
);
$form = parent::buildForm($form, $form_state);
return $form;
}