You are here

function backup_migrate_ui_destination_create in Backup and Migrate 5.2

Get a form to create a destination, or links for the available types.

1 string reference to 'backup_migrate_ui_destination_create'
backup_migrate_menu in ./backup_migrate.module
Implementation of hook_menu().

File

includes/destinations.inc, line 400
All of the destination handling code needed for Backup and Migrate.

Code

function backup_migrate_ui_destination_create($type = NULL) {
  $types = backup_migrate_get_destination_types();

  // If a valid type has been specified, present a form
  if (isset($types[$type])) {
    $destination = array(
      'type' => $type,
      'name' => t("Untitled Destination"),
    ) + $types[$type];
    $output = drupal_get_form('backup_migrate_ui_destination_configure_form', $destination);
  }
  else {
    $items = array();

    // If no (valid) node type has been provided, display a node type overview.
    foreach ($types as $key => $type) {
      if ($type['conf_callback']) {
        $type_url_str = str_replace('_', '-', $key);
        $out = '<dt>' . l($type['type_name'], "admin/content/backup_migrate/destination/add/{$type_url_str}", 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.');
    }
  }
  return $output;
}