You are here

function backup_migrate_schedule::edit_form in Backup and Migrate 8.2

Same name and namespace in other branches
  1. 8.3 includes/schedules.inc \backup_migrate_schedule::edit_form()
  2. 6.3 includes/schedules.inc \backup_migrate_schedule::edit_form()
  3. 6.2 includes/schedules.inc \backup_migrate_schedule::edit_form()
  4. 7.3 includes/schedules.inc \backup_migrate_schedule::edit_form()
  5. 7.2 includes/schedules.inc \backup_migrate_schedule::edit_form()

Get the edit form.

Overrides backup_migrate_item::edit_form

File

includes/schedules.inc, line 200

Class

backup_migrate_schedule
A schedule class for crud operations.

Code

function edit_form() {
  $form = parent::edit_form();
  backup_migrate_include('destinations', 'profiles');
  $form['enabled'] = array(
    "#type" => "checkbox",
    "#title" => t("Enabled"),
    "#default_value" => $this
      ->get('enabled'),
  );
  $form['name'] = array(
    "#type" => "textfield",
    "#title" => t("Schedule Name"),
    "#default_value" => $this
      ->get('name'),
  );
  $form += _backup_migrate_get_source_form($this
    ->get('source_id'));
  $form['profile_id'] = array(
    "#type" => "select",
    "#title" => t("Settings Profile"),
    "#options" => _backup_migrate_get_profile_form_item_options(),
    "#default_value" => $this
      ->get('profile_id'),
  );
  $form['profile_id']['#description'] = ' ' . l(t("Create new profile"), BACKUP_MIGRATE_MENU_PATH . "/profile/add");
  if (!$form['profile_id']['#options']) {
    $form['profile_id']['#options'] = array(
      '0' => t('-- None Available --'),
    );
  }
  $period_options = array();
  foreach ($this
    ->frequency_periods() as $type => $period) {
    $period_options[$type] = $period['title'];
  }
  $default_period = $this
    ->get_frequency_period();
  $default_period_num = $this
    ->get('period') / $default_period['seconds'];
  $form['period'] = array(
    "#type" => "item",
    "#title" => t("Backup every"),
    "#prefix" => '<div class="container-inline">',
    "#suffix" => '</div>',
    "#tree" => TRUE,
  );
  $form['period']['number'] = array(
    "#type" => "textfield",
    "#size" => 6,
    "#default_value" => $default_period_num,
  );
  $form['period']['type'] = array(
    "#type" => "select",
    "#options" => $period_options,
    "#default_value" => $default_period['type'],
  );
  $form['keep'] = array(
    "#type" => "textfield",
    "#size" => 6,
    "#title" => t("Number of Backup files to keep"),
    "#description" => t("The number of backup files to keep before deleting old ones. Use 0 to never delete backups. <strong>Other files in the destination directory will get deleted if you specify a limit.</strong>"),
    "#default_value" => $this
      ->get('keep'),
  );
  $destination_options = _backup_migrate_get_destination_form_item_options('scheduled backup');
  $form['destination_id'] = array(
    "#type" => "select",
    "#title" => t("Destination"),
    "#description" => t("Choose where the backup file will be saved. Backup files contain sensitive data, so be careful where you save them."),
    "#options" => $destination_options,
    "#default_value" => $this
      ->get('destination_id'),
  );
  $form['destination_id']['#description'] .= ' ' . l(t("Create new destination"), BACKUP_MIGRATE_MENU_PATH . "/destination/add");
  return $form;
}