You are here

public function DeleteMultiple::buildForm in Feeds 8.3

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 106

Class

DeleteMultiple
Provides a feed deletion confirmation form.

Namespace

Drupal\feeds\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $this->feeds = $this->tempStoreFactory
    ->get('feeds_feed_multiple_delete_confirm')
    ->get($this->user
    ->id());
  if (empty($this->feeds)) {
    return new RedirectResponse($this
      ->getCancelUrl()
      ->setAbsolute()
      ->toString());
  }
  $form['feeds'] = [
    '#theme' => 'item_list',
    '#items' => array_map(function ($feed) {
      return Html::escape($feed
        ->label());
    }, $this->feeds),
  ];
  return parent::buildForm($form, $form_state);
}