You are here

public function CronForm::submitForm in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/system/src/Form/CronForm.php \Drupal\system\Form\CronForm::submitForm()

Runs cron and reloads the page.

Overrides FormInterface::submitForm

File

core/modules/system/src/Form/CronForm.php, line 127
Contains \Drupal\system\Form\CronForm.

Class

CronForm
Configure cron settings for this site.

Namespace

Drupal\system\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {

  // Run cron manually from Cron form.
  if ($this->cron
    ->run()) {
    drupal_set_message(t('Cron run successfully.'));
  }
  else {
    drupal_set_message(t('Cron run failed.'), 'error');
  }
  return new RedirectResponse($this
    ->url('system.cron_settings', array(), array(
    'absolute' => TRUE,
  )));
}