You are here

public function SettingsForm::buildForm in Job Scheduler 8.3

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/SettingsForm.php, line 30

Class

SettingsForm
Configure form.

Namespace

Drupal\job_scheduler\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('job_scheduler.settings');
  $form['rebuild']['description'] = [
    '#markup' => '<p>' . t('Rebuilds scheduled information.') . '</p>',
  ];
  $form['rebuild']['run'] = [
    '#type' => 'submit',
    '#value' => t('Rebuild'),
    '#submit' => [
      '::rebuild',
    ],
  ];
  $form['settings'] = [
    '#title' => t('Settings'),
    '#type' => 'details',
    '#open' => TRUE,
  ];
  $form['settings']['logging'] = [
    '#type' => 'checkbox',
    '#title' => t('Detailed job scheduler logging'),
    '#default_value' => $config
      ->get('logging'),
    '#description' => $this
      ->t('Run time info of jobs will be written to watchdog.'),
  ];
  $form['settings']['limit'] = [
    '#type' => 'number',
    '#title' => t('Jobs limit'),
    '#min' => 1,
    '#default_value' => $config
      ->get('limit'),
    '#description' => t('The number of jobs to perform in one run. Defaults to 200'),
  ];
  $form['settings']['time'] = [
    '#type' => 'number',
    '#title' => t('Executing time'),
    '#min' => 1,
    '#default_value' => $config
      ->get('time'),
    '#description' => t('How much time scheduler should spend on processing jobs in seconds. Defaults to 30'),
  ];
  return parent::buildForm($form, $form_state);
}