You are here

public function Batch::configurationForm in Organic groups 8

Returns the configuration form elements specific to this plugin.

Parameters

array $form: The form definition array.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The renderable form array representing the entire configuration form.

Overrides OgDeleteOrphansBase::configurationForm

File

src/Plugin/OgDeleteOrphans/Batch.php, line 35

Class

Batch
Performs a batch deletion of orphans.

Namespace

Drupal\og\Plugin\OgDeleteOrphans

Code

public function configurationForm(array $form, FormStateInterface $form_state) {
  $count = $this
    ->getQueue()
    ->numberOfItems();
  return [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('Batch options'),
    'info' => [
      '#markup' => '<p>' . $this
        ->t('There are :count orphans waiting to be deleted.', [
        ':count' => $count,
      ]) . '</p>',
    ],
    'submit' => [
      '#type' => 'submit',
      '#value' => $this
        ->t('Start batch deletion'),
      '#submit' => [
        '\\Drupal\\og\\Plugin\\OgDeleteOrphans\\Batch::batchSubmit',
      ],
      '#disabled' => !(bool) $count,
    ],
  ];
}