You are here

public function MobQueueSettings::buildForm in Drush Queue Handling 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 ConfigFormBase::buildForm

File

src/Form/MobQueueSettings.php, line 45
Contains \Drupal\mob_queue\Form\MobQueueSettings.

Class

MobQueueSettings

Namespace

Drupal\mob_queue\Form

Code

public function buildForm(array $form, \Drupal\Core\Form\FormStateInterface $form_state) {

  //$queues = \Drupal::moduleHandler()->invokeAll('cron_queue_info');
  $queues = \Drupal::service('mob_queue.operator')
    ->discoverQueueJobs();
  $config = $this
    ->config('mob_queue.settings');
  $form['mob_qinfo'] = [
    //'#type' => 'fieldset',
    '#title' => t('Drush Queue Handling'),
    '#tree' => TRUE,
  ];
  foreach ($queues as $name) {
    $form['mob_qinfo'][$name] = array(
      '#type' => 'checkbox',
      '#title' => $name,
      '#description' => t('Use Drush Queue Handling(mob_queue.) Turn off queue @name process in cron.', array(
        '@name' => $name,
      )),
      '#default_value' => $config
        ->get('mob_qinfo.' . $name),
    );
  }
  return parent::buildForm($form, $form_state);
}