public function CronForm::runCron in Drupal 10
Same name and namespace in other branches
- 8 core/modules/system/src/Form/CronForm.php \Drupal\system\Form\CronForm::runCron()
- 9 core/modules/system/src/Form/CronForm.php \Drupal\system\Form\CronForm::runCron()
Form submission handler for running cron manually.
File
- core/
modules/ system/ src/ Form/ CronForm.php, line 165
Class
- CronForm
- Configure cron settings for this site.
Namespace
Drupal\system\FormCode
public function runCron(array &$form, FormStateInterface $form_state) {
if ($this->cron
->run()) {
$this
->messenger()
->addStatus($this
->t('Cron ran successfully.'));
}
else {
$this
->messenger()
->addError($this
->t('Cron run failed.'));
}
}