You are here

public function ConfirmBanDeleteMultiple::buildForm in Comment IP 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 DeleteMultipleForm::buildForm

File

src/Form/ConfirmBanDeleteMultiple.php, line 39

Class

ConfirmBanDeleteMultiple
Provides the comment_ip multiple ban delete confirmation form.

Namespace

Drupal\comment_ip\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form = parent::buildForm($form, $form_state);
  foreach ($form['comments'] as $key => $value) {
    if (is_numeric($key)) {
      $comment = Comment::load($key);
      $form['comments'][$key]['#suffix'] = Html::escape($comment
        ->label() . ' - ' . $comment
        ->getHostname()) . '</li>';
    }
  }
  $form['operation'] = [
    '#type' => 'hidden',
    '#value' => 'ban',
  ];
  return $form;
}