function CronExampleForm::submitForm

Same name in other branches
  1. 3.x modules/cron_example/src/Form/CronExampleForm.php \Drupal\cron_example\Form\CronExampleForm::submitForm()

Overrides ConfigFormBase::submitForm

File

modules/cron_example/src/Form/CronExampleForm.php, line 262

Class

CronExampleForm
Form with examples on how to use cron.

Namespace

Drupal\cron_example\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
    // Update the interval as stored in configuration. This will be read when
    // this modules hook_cron function fires and will be used to ensure that
    // action is taken only after the appropiate time has elapsed.
    $this->config('cron_example.settings')
        ->set('interval', $form_state->getValue('cron_example_interval'))
        ->save();
    parent::submitForm($form, $form_state);
}