You are here

function backup_migrate_destination_nodesquirrel::edit_form in Backup and Migrate 8.3

Same name and namespace in other branches
  1. 6.3 includes/destinations.nodesquirrel.inc \backup_migrate_destination_nodesquirrel::edit_form()
  2. 6.2 includes/destinations.nodesquirrel.inc \backup_migrate_destination_nodesquirrel::edit_form()
  3. 7.2 includes/destinations.nodesquirrel.inc \backup_migrate_destination_nodesquirrel::edit_form()

Get the form for the settings for this destination.

Overrides backup_migrate_destination::edit_form

File

includes/destinations.nodesquirrel.inc, line 531
Functions to handle the NodeSquirrel backup destination.

Class

backup_migrate_destination_nodesquirrel
A destination for sending database backups to the NodeSquirel backup service.

Code

function edit_form() {
  $form = parent::edit_form();

  // If this is a new destination but the default NS destination has not been created yet,
  // redirect to the NS config screen.
  if (!$this
    ->get_id() && !variable_get('nodesquirrel_secret_key', '')) {
    drupal_goto(BACKUP_MIGRATE_MENU_PATH . '/nodesquirrel');
  }
  $form['settings'] = array(
    '#tree' => TRUE,
  );
  $activate_link = backup_migrate_nodesquirrel_get_activate_link();

  // Retrieve the key from the settings or get it from the get string if this is an auto-config action.
  $key = $this
    ->settings('secret_key');
  if (!empty($_GET['key']) && preg_match(NODESQUIRREL_SECRET_KEY_PATTERN, $_GET['key'])) {
    $key = $_GET['key'];
  }
  $form['settings']['secret_key'] = array(
    '#type' => 'textfield',
    '#title' => t('Secret Key'),
    '#default_value' => $key,
  );
  $form['settings']['location'] = array(
    '#type' => 'value',
    '#value' => '',
  );
  $form['settings']['secret_key_help'] = array(
    '#type' => 'item',
    '#title' => t('Need a Secret Key?'),
    '#markup' => t('Visit !nodesquirrel.', array(
      '!nodesquirrel' => $activate_link,
    )),
  );
  return $form;
}