You are here

function backup_migrate_item::edit_form in Backup and Migrate 8.3

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

Get the edit form for the item.

3 calls to backup_migrate_item::edit_form()
backup_migrate_location::edit_form in includes/locations.inc
Get the edit form for the item.
backup_migrate_profile::edit_form in includes/profiles.inc
Get the edit form.
backup_migrate_schedule::edit_form in includes/schedules.inc
Get the edit form.
3 methods override backup_migrate_item::edit_form()
backup_migrate_location::edit_form in includes/locations.inc
Get the edit form for the item.
backup_migrate_profile::edit_form in includes/profiles.inc
Get the edit form.
backup_migrate_schedule::edit_form in includes/schedules.inc
Get the edit form.

File

includes/crud.inc, line 777
CRUD functions for backup and migrate types (schedules, profiles etc.).

Class

backup_migrate_item
A base class for items which can be stored in the database, listed, edited, deleted etc.

Code

function edit_form() {
  $form = array();
  $form['item'] = array(
    '#type' => 'value',
    '#value' => $this,
  );
  $name = $this
    ->get('name');
  $form['name'] = array(
    "#type" => "textfield",
    "#title" => t("!type name", array(
      '!type' => $this->title_singular,
    )),
    "#default_value" => empty($name) ? t('Untitled !type', array(
      '!type' => $this->title_singular,
    )) : $name,
    "#required" => TRUE,
  );
  $form['id'] = array(
    '#type' => 'value',
    '#value' => $this
      ->get_id(),
  );
  $form['machine_name'] = array(
    '#type' => 'machine_name',
    '#default_value' => $this
      ->get_id(),
    '#maxlength' => 255,
    '#machine_name' => array(
      'source' => array(
        'name',
      ),
      'exists' => 'backup_migrate_crud_item_exists',
    ),
  );
  $form['actions'] = array(
    '#prefix' => '<div class="container-inline">',
    '#suffix' => '</div>',
    '#weight' => 99,
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save !type', array(
      '!type' => t($this->singular),
    )),
  );
  $form['actions']['cancel'] = array(
    '#value' => l(t('Cancel'), $this
      ->get_settings_path()),
  );
  return $form;
}