function backup_migrate_nodesquirrel_schedule_settings_form in Backup and Migrate 8.3
1 call to backup_migrate_nodesquirrel_schedule_settings_form()
- backup_migrate_nodesquirrel_settings_form in includes/
destinations.nodesquirrel.inc - NodeSquirrel settings form.
File
- includes/
destinations.nodesquirrel.inc, line 232 - Functions to handle the NodeSquirrel backup destination.
Code
function backup_migrate_nodesquirrel_schedule_settings_form($destination, $status) {
backup_migrate_include('sources', 'schedules', 'profiles');
// If the schedule has been overriden it must be edited in the schedule tab.
$schedule = backup_migrate_crud_get_item('schedule', 'nodesquirrel');
$default = 60 * 60 * 24;
$form = array();
$form['nodesquirrel_schedule'] = array(
'#type' => 'fieldset',
'#title' => t('Backup Schedule'),
'#description' => t('Set up a schedule to back up your site to NodeSquirrel. You can customize this schedule or add additional schedules in the !schedule.', array(
'!schedule' => l(t('Schedules tab'), BACKUP_MIGRATE_MENU_PATH . '/schedule'),
'!cron' => l(t('cron'), 'http://drupal.org/cron'),
)),
);
$key = 'nodesquirrel_schedule';
$form['nodesquirrel_schedule'][$key] = array();
$defaults = array(
'period' => empty($schedule) ? variable_get('nodesquirrel_schedule', 60 * 60 * 24) : $schedule
->get('period'),
'enabled' => empty($schedule) ? variable_get('nodesquirrel_schedule_enabled', TRUE) : $schedule
->get('enabled'),
'source_id' => empty($schedule) ? variable_get('nodesquirrel_schedule_source_id', 'db') : $schedule
->get('source_id'),
);
$form['nodesquirrel_schedule'][$key]['nodesquirrel_schedule_enabled'] = array(
'#type' => 'checkbox',
'#title' => t('Automatically backup to NodeSquirrel'),
'#default_value' => $defaults['enabled'],
);
$form['nodesquirrel_schedule'][$key]['settings'] = array(
'#type' => 'backup_migrate_dependent',
'#dependencies' => array(
'nodesquirrel_schedule_enabled' => TRUE,
),
);
$form['nodesquirrel_schedule'][$key]['settings']['nodesquirrel_schedule_source_id'] = _backup_migrate_get_source_pulldown($defaults['source_id']);
$options = array(
60 * 60 => t('Once an hour'),
60 * 60 * 24 => t('Once a day'),
60 * 60 * 24 * 7 => t('Once a week'),
);
$period = $defaults['period'];
if (!isset($options[$period])) {
$options[$period] = empty($schedule) ? t('Custom') : $schedule
->get('frequency_description');
}
$form['nodesquirrel_schedule'][$key]['settings']['nodesquirrel_schedule'] = array(
'#type' => 'select',
'#title' => t('Schedule Frequency'),
'#options' => $options,
'#default_value' => $period,
);
return $form;
}