You are here

function _backup_migrate_ui_backup_settings_form in Backup and Migrate 7.3

Same name and namespace in other branches
  1. 8.2 includes/profiles.inc \_backup_migrate_ui_backup_settings_form()
  2. 8.3 includes/profiles.inc \_backup_migrate_ui_backup_settings_form()
  3. 5.2 includes/profiles.inc \_backup_migrate_ui_backup_settings_form()
  4. 6.3 includes/profiles.inc \_backup_migrate_ui_backup_settings_form()
  5. 6.2 includes/profiles.inc \_backup_migrate_ui_backup_settings_form()
  6. 7.2 includes/profiles.inc \_backup_migrate_ui_backup_settings_form()

Get a form to configure the profile.

2 calls to _backup_migrate_ui_backup_settings_form()
backup_migrate_profile::edit_form in includes/profiles.inc
Get the edit form.
backup_migrate_ui_manual_backup_form in ./backup_migrate.module
The backup/export form.

File

includes/profiles.inc, line 89

Code

function _backup_migrate_ui_backup_settings_form($profile) {
  require_once dirname(__FILE__) . '/destinations.inc';
  require_once dirname(__FILE__) . '/files.inc';
  require_once dirname(__FILE__) . '/filters.inc';
  drupal_add_js(array(
    'backup_migrate' => array(
      'checkboxLinkText' => t('View as checkboxes'),
    ),
  ), array(
    'type' => 'setting',
  ));
  drupal_add_js(drupal_get_path('module', 'backup_migrate') . '/backup_migrate.js', array(
    'type' => 'file',
    'scope' => 'footer',
  ));
  drupal_add_css(drupal_get_path('module', 'backup_migrate') . '/backup_migrate.css');
  $form = array();
  $form['file'] = array(
    "#type" => "fieldset",
    "#title" => t("Backup File"),
    "#collapsible" => TRUE,
    "#collapsed" => FALSE,
    "#tree" => FALSE,
  );
  $form['file']['filename'] = array(
    "#type" => "textfield",
    "#title" => t("Backup file name"),
    "#default_value" => $profile->filename,
  );
  if (module_exists('token')) {
    $form['file']['token_help'] = array(
      '#title' => t('Replacement patterns'),
      '#type' => 'fieldset',
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
    );
    $form['file']['token_help']['help'] = array(
      '#theme' => 'token_tree',
      '#token_types' => array(
        'current-date',
        'site',
      ),
      '#global_types' => FALSE,
    );
    $form['file']['filename']['#description'] = t('You can use tokens in the file name.');
  }
  $form['file']['append_timestamp'] = array(
    "#type" => "radios",
    '#options' => array(
      0 => t('Create separate backups if `Backup file name` already exists'),
      2 => t('Overwrite the existing backup file'),
      1 => t('Append the timestamp'),
    ),
    "#title" => t("Save mode"),
    "#default_value" => $profile->append_timestamp,
  );
  $form['file']['timestamp_format_wrapper'] = array(
    '#type' => 'backup_migrate_dependent',
    '#dependencies' => array(
      'append_timestamp' => 1,
    ),
  );
  $form['file']['timestamp_format_wrapper']['timestamp_format'] = array(
    "#type" => "textfield",
    "#title" => t("Timestamp format"),
    "#default_value" => $profile->timestamp_format,
    "#description" => t('Should be a PHP <a href="!url">date()</a> format string.', array(
      '!url' => 'http://www.php.net/date',
    )),
  );
  $form['advanced'] = array(
    '#weight' => 10,
  );
  $form = array_merge_recursive($form, backup_migrate_filters_settings_form($profile->filters, 'backup'));

  // Add the advanced fieldset if there are any fields in it.
  if ($form['advanced']) {
    $form['advanced']['#type'] = 'fieldset';
    $form['advanced']['#title'] = t('Advanced Options');
    $form['advanced']['#collapsed'] = TRUE;
    $form['advanced']['#collapsible'] = TRUE;
  }
  $form['#validate'][] = '_backup_migrate_ui_backup_settings_form_validate';
  $form['#submit'][] = '_backup_migrate_ui_backup_settings_form_submit';
  return $form;
}