You are here

public function ProcessQueueForm::buildForm in Field Encryption 3.0.x

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/ProcessQueueForm.php, line 65

Class

ProcessQueueForm
Form builder for the field_encrypt process queue form.

Namespace

Drupal\field_encrypt\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $entity_update_count = $this->queueFactory
    ->get('field_encrypt_update_entity_encryption')
    ->numberOfItems();
  $form['status'] = [
    '#type' => 'item',
    '#markup' => $this
      ->formatPlural($entity_update_count, 'There is one entity queued for updating to use the latest field encryption settings.', 'There are @count entities queued for updating to use the latest field encryption settings.'),
    '#suffix' => '<p>',
    '#prefix' => '</p>',
  ];
  $form['actions']['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Process updates'),
    '#access' => $entity_update_count > 0,
  ];
  return $form;
}