You are here

public function HttpblWhitelistForm::buildForm in http:BL 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/HttpblWhitelistForm.php, line 74

Class

HttpblWhitelistForm
Displays banned IP addresses.

Namespace

Drupal\httpbl\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['advise'] = array(
    '#markup' => '<div class="httpbl-advice form-item">' . $this
      ->t('Please note:  Session white-listing requires cookies to be enabled.') . '</div>',
  );
  $form['reason'] = array(
    '#type' => 'textarea',
    '#title' => t('Reason you were blocked. (It\'s okay to say you don\'t know if you don\'t)'),
    '#size' => 60,
    '#required' => TRUE,
  );
  $form['block'] = array(
    '#type' => 'textfield',
    '#title' => t('LEAVE THIS BLANK! (This is where robotic spammers fail, because they don\'t actually read!)'),
    '#size' => 15,
  );
  $form['leave'] = array(
    '#type' => 'textfield',
    '#size' => 30,
    '#attributes' => array(
      'style' => 'display: none',
    ),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('White-list request'),
  );

  // Save incoming original destination as a hidden form value.
  // This has never worked.  Need a new approach.
  // @todo - Figure out a way to return visitor to original request if they
  // pass the challenge.
  $form['arrival'] = array(
    '#type' => 'hidden',
  );
  return $form;
}