You are here

public function RunForm::buildForm in Security Review 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/RunForm.php, line 51

Class

RunForm
Provides implementation for the Run form.

Namespace

Drupal\security_review\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  if (!$this
    ->currentUser()
    ->hasPermission('run security checks')) {
    return [];
  }
  $form['run_form'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('Run'),
    '#description' => $this
      ->t('Click the button below to run the security checklist and review the results.') . '<br />',
    '#open' => TRUE,
  ];
  $form['run_form']['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Run checklist'),
  ];

  // Return the finished form.
  return $form;
}