You are here

function theme_backup_migrate_ui_quick_schedule_form_inline in Backup and Migrate 8.3

Same name and namespace in other branches
  1. 6.3 backup_migrate.module \theme_backup_migrate_ui_quick_schedule_form_inline()
  2. 7.3 backup_migrate.module \theme_backup_migrate_ui_quick_schedule_form_inline()

Theme the quick schedule form.

File

./backup_migrate.module, line 878
Create (manually or scheduled) and restore backups of your Drupal MySQL database with an option to exclude table data (e.g. cache_*)

Code

function theme_backup_migrate_ui_quick_schedule_form_inline($form) {
  drupal_add_js(drupal_get_path('module', 'backup_migrate') . '/backup_migrate.js');
  drupal_add_css(drupal_get_path('module', 'backup_migrate') . '/backup_migrate.css');
  $form = $form['form'];

  // Remove the titles so that the pulldowns can be displayed inline.
  unset($form['settings']['source_id']['#title']);
  unset($form['settings']['period']['#title']);
  unset($form['settings']['destination']['destination_id']['#title']);
  unset($form['settings']['destination']['destination_id']['#description']);
  unset($form['settings']['profile_id']['#title']);
  unset($form['settings']['destination']['copy_destination']['copy_destination_id']['#title']);
  unset($form['settings']['profile_id']['#title']);
  unset($form['settings']['keep']['#title']);
  unset($form['settings']['keep']['#field_prefix']);
  unset($form['settings']['keep']['#field_suffix']);
  $replacements = array(
    '!from' => drupal_render($form['settings']['source_id']),
    '!to' => drupal_render($form['settings']['destination']['destination_id']),
    '!frequency' => drupal_render($form['settings']['period']),
    '!profile' => drupal_render($form['settings']['profile_id']),
    '!keep' => drupal_render($form['settings']['keep']),
  );
  $form['settings'] = array(
    'inline' => array(
      '#type' => 'markup',
      "#prefix" => '<div class="container-inline backup-migrate-quickschedule">',
      "#suffix" => '</div>',
      '#markup' => t('Backup !frequency to !to using !profile keeping !keep', $replacements),
    ),
  ) + $form['settings'];
  $replacements = array(
    '!to' => drupal_render($form['settings']['destination']['copy_destination']['copy_destination_id']),
  );
  $form['settings']['destination']['copy']["#prefix"] = '<div class="container-inline backup-migrate-inline">';
  $form['settings']['destination']['copy']["#suffix"] = $replacements['!to'] . '</div>';
  unset($form['settings']['period']);
  unset($form['settings']['destination']['destination_id']);
  unset($form['settings']['destination']['copy_destination']);
  unset($form['settings']['profile_id']);
  unset($form['settings']['keep']);
  return drupal_render_children($form);
}