You are here

function backup_migrate_destination::edit_form in Backup and Migrate 8.3

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

Get the edit form for the item.

Overrides backup_migrate_location::edit_form

4 calls to backup_migrate_destination::edit_form()
backup_migrate_destination_email::edit_form in includes/destinations.email.inc
Get the form for the settings for this filter.
backup_migrate_destination_files::edit_form in includes/destinations.file.inc
Get the form for the settings for the files destination.
backup_migrate_destination_nodesquirrel::edit_form in includes/destinations.nodesquirrel.inc
Get the form for the settings for this destination.
backup_migrate_destination_remote::edit_form in includes/destinations.inc
Destination configuration callback.
4 methods override backup_migrate_destination::edit_form()
backup_migrate_destination_email::edit_form in includes/destinations.email.inc
Get the form for the settings for this filter.
backup_migrate_destination_files::edit_form in includes/destinations.file.inc
Get the form for the settings for the files destination.
backup_migrate_destination_nodesquirrel::edit_form in includes/destinations.nodesquirrel.inc
Get the form for the settings for this destination.
backup_migrate_destination_remote::edit_form in includes/destinations.inc
Destination configuration callback.

File

includes/destinations.inc, line 978

Class

backup_migrate_destination
A base class for creating destinations.

Code

function edit_form() {
  if (get_class($this) !== 'backup_migrate_destination') {
    $form = parent::edit_form();
    $form['subtype'] = array(
      "#type" => "value",
      "#default_value" => $this
        ->get('subtype'),
    );
  }
  else {
    $types = backup_migrate_get_destination_subtypes();
    $items = array(
      'remote' => array(
        'title' => t('Offsite Destinations'),
        'description' => t('For the highest level of protection, set up an offsite backup destination in a location separate from your website.'),
        'items' => array(),
      ),
      'local' => array(
        'title' => t('Local Destinations'),
        'description' => t('Local backups are quick and convenient but do not provide the additional safety of offsite backups.'),
        'items' => array(),
      ),
      'other' => array(
        'title' => t('Other Destinations'),
        'description' => t('These destinations have not been classified because they were created for Backup and Migrate version 2. They may not work correctly with this version.'),
        'items' => array(),
      ),
    );

    // If no (valid) node type has been provided, display a node type overview.
    $path = $this
      ->get_settings_path();
    foreach ($types as $key => $type) {
      if (@$type['can_create']) {
        $type_url_str = str_replace('_', '-', $key);
        $out = '<dt>' . l($type['type_name'], $path . "/add/{$type_url_str}", array(
          'attributes' => array(
            'title' => t('Add a new @s destination.', array(
              '@s' => $type['type_name'],
            )),
          ),
        )) . '</dt>';
        $out .= '<dd>' . filter_xss_admin($type['description']) . '</dd>';
        if (!empty($type['local'])) {
          $items['local']['items'][] = $out;
        }
        if (!empty($type['remote'])) {
          $items['remote']['items'][] = $out;
        }
        if (empty($type['local']) && empty($type['remote'])) {
          $items['other']['items'][] = $out;
        }
      }
    }
    if (count($items['local']['items']) || count($items['remote']['items']) || count($items['other']['items'])) {
      $output = '<p>' . t('Choose the type of destination you would like to create:') . '</p>';
      foreach ($items as $group) {
        if (count($group['items'])) {
          $group['body'] = '<dl>' . implode('', $group['items']) . '</dl>';
          $output .= theme('backup_migrate_group', $group);
        }
      }
    }
    else {
      $output = t('No destination types available.');
    }
    $form['select_type'] = array(
      '#type' => 'markup',
      '#markup' => $output,
    );
  }
  return $form;
}