public function SchedulerCronForm::generateRandomKey in Scheduler 8
Same name and namespace in other branches
- 2.x src/Form/SchedulerCronForm.php \Drupal\scheduler\Form\SchedulerCronForm::generateRandomKey()
Form submission handler for the random key generation.
This only fires when the 'Generate new random key' button is clicked.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
File
- src/
Form/ SchedulerCronForm.php, line 140
Class
- SchedulerCronForm
- Scheduler Lightweight Cron form.
Namespace
Drupal\scheduler\FormCode
public function generateRandomKey(array &$form, FormStateInterface $form_state) {
$config = $this
->config('scheduler.settings');
$config
->set('lightweight_cron_access_key', substr(md5(rand()), 0, 20));
$config
->save();
parent::submitForm($form, $form_state);
}