' . t('About') . ''; $output .= '

' . t('The Automated Cron module runs cron operations for your site using normal browser/page requests instead of having to set up a separate cron job. The Automated Cron module checks at the end of each server response when cron operation was last ran and, if it has been too long since last run, it executes the cron tasks after sending a server response. For more information, see the online documentation for the Automated Cron module.', [':automated_cron-documentation' => 'https://www.drupal.org/documentation/modules/automated_cron']) . '

'; $output .= '

' . t('Uses') . '

'; $output .= '
'; $output .= '
' . t('Configuring Automated Cron') . '
'; $output .= '
' . t('On the Cron page, you can set the frequency (time interval) for running cron jobs.', [':cron-settings' => \Drupal::url('system.cron_settings')]) . '
'; $output .= '
' . t('Disabling Automated Cron') . '
'; $output .= '
' . t('To disable automated cron, the recommended method is to uninstall the module, to reduce site overhead. If you only want to disable it temporarily, you can set the frequency to Never on the Cron page, and then change the frequency back when you want to start it up again.') . '
'; $output .= '
'; return $output; } } /** * Implements hook_form_FORM_ID_alter() for the system_cron_settings() form. */ function automated_cron_form_system_cron_settings_alter(&$form, &$form_state) { $automated_cron_settings = \Drupal::config('automated_cron.settings'); $options = [3600, 10800, 21600, 43200, 86400, 604800]; $form['cron']['interval'] = [ '#type' => 'select', '#title' => t('Run cron every'), '#description' => t('More information about setting up scheduled tasks can be found by reading the cron tutorial on drupal.org.', ['@url' => 'https://www.drupal.org/cron']), '#default_value' => $automated_cron_settings->get('interval'), '#options' => [0 => t('Never')] + array_map([\Drupal::service('date.formatter'), 'formatInterval'], array_combine($options, $options)), ]; // Add submit callback. $form['#submit'][] = 'automated_cron_settings_submit'; // Theme this form as a config form. $form['#theme'] = 'system_config_form'; } /** * Form submission handler for system_cron_settings(). */ function automated_cron_settings_submit(array $form, FormStateInterface $form_state) { \Drupal::configFactory()->getEditable('automated_cron.settings') ->set('interval', $form_state->getValue('interval')) ->save(); }