You are here

public function DeleteMultiple::buildForm in Profile 2 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 99
Contains \Drupal\node\Form\DeleteMultiple.

Class

DeleteMultiple
Provides a node deletion confirmation form.

Namespace

Drupal\profile\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $this->profiles = $this->privateTempStoreFactory
    ->get('profile_multiple_delete_confirm')
    ->get(\Drupal::currentUser()
    ->id());
  if (empty($this->profiles)) {
    return new RedirectResponse(\Drupal::url('admin/config/people/profiles', array(
      'absolute' => TRUE,
    )));
  }
  $form['profiles'] = array(
    '#theme' => 'item_list',
    '#items' => array_map(function ($profile) {
      return String::checkPlain($profile
        ->label());
    }, $this->profiles),
  );
  $form = parent::buildForm($form, $form_state);
  return $form;
}