You are here

function backup_migrate_location::edit_form in Backup and Migrate 8.3

Same name and namespace in other branches
  1. 6.3 includes/locations.inc \backup_migrate_location::edit_form()
  2. 7.3 includes/locations.inc \backup_migrate_location::edit_form()

Get the edit form for the item.

Overrides backup_migrate_item::edit_form

4 calls to backup_migrate_location::edit_form()
backup_migrate_destination::edit_form in includes/destinations.inc
Get the edit form for the item.
backup_migrate_destination_filesource::edit_form in includes/sources.filesource.inc
Get the form for the settings for the files destination.
backup_migrate_location_remote::edit_form in includes/locations.inc
location configuration callback.
backup_migrate_source_remote::edit_form in includes/sources.inc
source configuration callback.
4 methods override backup_migrate_location::edit_form()
backup_migrate_destination::edit_form in includes/destinations.inc
Get the edit form for the item.
backup_migrate_destination_filesource::edit_form in includes/sources.filesource.inc
Get the form for the settings for the files destination.
backup_migrate_location_remote::edit_form in includes/locations.inc
location configuration callback.
backup_migrate_source_remote::edit_form in includes/sources.inc
source configuration callback.

File

includes/locations.inc, line 170

Class

backup_migrate_location
A base class for creating locations.

Code

function edit_form() {
  if (!empty($this->supported_ops)) {
    $form = parent::edit_form();
    $form['subtype'] = array(
      "#type" => "value",
      "#default_value" => $this
        ->get('subtype'),
    );
  }
  else {
    $types = $this
      ->location_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 . "/settings/{$this->type_name}/add/{$type_url_str}", array(
          'attributes' => array(
            'title' => t('Add a new @s location.', 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 location you would like to create:') . '<dl>' . implode('', $items) . '</dl>';
    }
    else {
      $output = t('No types available.');
    }
    $form['select_type'] = array(
      '#type' => 'markup',
      '#markup' => $output,
    );
  }
  return $form;
}