Form builder; Cron form.
function system_cron_settings($form, &$form_state) {
$form['description'] = array(
'#markup' => '<p>' . t('Cron takes care of running periodic tasks like checking for updates and indexing content for search.') . '</p>',
);
$form['run'] = array(
'#type' => 'submit',
'#value' => t('Run cron'),
'#submit' => array(
'system_run_cron_submit',
),
);
$status = '<p>' . t('Last run: %cron-last ago.', array(
'%cron-last' => format_interval(REQUEST_TIME - state()
->get('system.cron_last')),
)) . '</p>';
$form['status'] = array(
'#markup' => $status,
);
$form['cron_url'] = array(
'#markup' => '<p>' . t('To run cron from outside the site, go to <a href="!cron">!cron</a>', array(
'!cron' => url('cron/' . state()
->get('system.cron_key'), array(
'absolute' => TRUE,
)),
)) . '</p>',
);
$form['cron'] = array(
'#type' => 'details',
);
$form['cron']['cron_safe_threshold'] = array(
'#type' => 'select',
'#title' => t('Run cron every'),
'#default_value' => config('system.cron')
->get('threshold.autorun'),
'#options' => array(
0 => t('Never'),
) + drupal_map_assoc(array(
3600,
10800,
21600,
43200,
86400,
604800,
), 'format_interval'),
);
return system_config_form($form, $form_state);
}