You are here

function backup_migrate_destination::edit_form in Backup and Migrate 6.2

Same name and namespace in other branches
  1. 8.2 includes/destinations.inc \backup_migrate_destination::edit_form()
  2. 8.3 includes/destinations.inc \backup_migrate_destination::edit_form()
  3. 6.3 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_item::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 704

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['name'] = array(
      "#type" => "textfield",
      "#title" => t("Destination name"),
      "#default_value" => $this
        ->get_name(),
      "#required" => TRUE,
    );
    $form['type'] = array(
      "#type" => "value",
      "#default_value" => $this->destination_type,
    );
  }
  else {
    $types = backup_migrate_get_destination_types();
    $items = array();

    // If no (valid) node type has been provided, display a node type overview.
    foreach ($types as $key => $type) {
      if (@$type['can_create']) {
        $type_url_str = str_replace('_', '-', $key);
        $out = '<dt>' . l($type['type_name'], BACKUP_MIGRATE_MENU_PATH . "/destination/list/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>';
        $items[] = $out;
      }
    }
    if (count($items)) {
      $output = t('Choose the type of destination you would like to create:') . '<dl>' . implode('', $items) . '</dl>';
    }
    else {
      $output = t('No destination types available.');
    }
    $form['select_type'] = array(
      '#type' => 'markup',
      '#value' => $output,
    );
  }
  return $form;
}