/**
  * @param array $form
  * @param \Drupal\Core\Form\FormStateInterface $form_state
  * @param null $backup_migrate_destination
  * @param null $backup_id
  * @return array
  */
 public function buildForm(array $form, FormStateInterface $form_state, $backup_migrate_destination = NULL, $backup_id = NULL)
 {
     $this->destination = $backup_migrate_destination;
     $this->backup_id = $backup_id;
     $bam = backup_migrate_get_service_object();
     $form['source_id'] = DrupalConfigHelper::getPluginSelector($bam->sources(), $this->t('Restore To'));
     $conf_schema = $bam->plugins()->map('configSchema', array('operation' => 'restore'));
     $form += DrupalConfigHelper::buildFormFromSchema($conf_schema, $bam->plugins()->config());
     return parent::buildForm($form, $form_state);
 }
 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     $form = array();
     $bam = backup_migrate_get_service_object();
     $form['backup_migrate_restore_upload'] = array('#title' => t('Upload a Backup File'), '#type' => 'file', '#description' => t("Upload a backup file created by Backup and Migrate. For other database or file backups please use another tool for import. Max file size: %size", array("%size" => format_size(file_upload_max_size()))));
     $form['source_id'] = DrupalConfigHelper::getPluginSelector($bam->sources(), $this->t('Restore To'));
     $conf_schema = $bam->plugins()->map('configSchema', array('operation' => 'restore'));
     $form += DrupalConfigHelper::buildFormFromSchema($conf_schema, $bam->plugins()->config());
     $form['quickbackup']['submit'] = array('#type' => 'submit', '#value' => t('Restore now'), '#weight' => 1);
     return $form;
 }
 /**
  * {@inheritdoc}
  */
 public function form(array $form, FormStateInterface $form_state)
 {
     $form = parent::form($form, $form_state);
     $backup_migrate_settings = $this->entity;
     $form['label'] = array('#type' => 'textfield', '#title' => $this->t('Label'), '#maxlength' => 255, '#default_value' => $backup_migrate_settings->label(), '#required' => TRUE);
     $form['id'] = array('#type' => 'machine_name', '#default_value' => $backup_migrate_settings->id(), '#machine_name' => array('exists' => '\\Drupal\\backup_migrate\\Entity\\SettingsProfile::load'), '#disabled' => !$backup_migrate_settings->isNew());
     $bam = backup_migrate_get_service_object($backup_migrate_settings->get('config'));
     $conf_schema = $bam->plugins()->map('configSchema', array('operation' => 'backup'));
     $form['config'] = DrupalConfigHelper::buildFormFromSchema($conf_schema, $bam->plugins()->config(), ['config']);
     return $form;
 }
 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     $form = array();
     // Theme the form if we want it inline.
     // @FIXME
     // $form['#theme'] = 'backup_migrate_ui_manual_quick_backup_form_inline';
     $bam = backup_migrate_get_service_object();
     $form['source'] = array('#type' => 'fieldset', "#title" => t("Source"), "#collapsible" => TRUE, "#collapsed" => FALSE, "#tree" => FALSE);
     $form['source']['source_id'] = DrupalConfigHelper::getPluginSelector($bam->plugins()->getAllByOp('exportToFile'), t('Backup Source'));
     $form['source']['source_id']['#default_value'] = \Drupal::config('backup_migrate.settings')->get('backup_migrate_source_id');
     $conf_schema = $bam->plugins()->map('configSchema', array('operation' => 'backup'));
     $form += DrupalConfigHelper::buildFormFromSchema($conf_schema, $bam->plugins()->config());
     $form['destination'] = array('#type' => 'fieldset', "#title" => t("Destination"), "#collapsible" => TRUE, "#collapsed" => FALSE, "#tree" => FALSE);
     $form['destination']['destination_id'] = DrupalConfigHelper::getPluginSelector($bam->plugins()->getAllByOp('saveFile'), t('Backup Destination'));
     $form['destination']['destination_id']['#default_value'] = \Drupal::config('backup_migrate.settings')->get('backup_migrate_destination_id');
     $form['quickbackup']['submit'] = array('#type' => 'submit', '#value' => t('Backup now'), '#weight' => 1);
     return $form;
 }
 /**
  * Build the configuration form for a single plugin, source or destination.
  *
  * @param \BackupMigrate\Core\Config\ConfigurableInterface $plugin
  *  The plugin, source or destination to build the form for.
  * @param string $operation
  *  'backup', 'restore', or 'initialize' depending on the operation being configured for.
  * @param array $parents
  * @return array
  */
 public static function buildPluginForm($plugin, $operation, $parents = ['config'])
 {
     $schema = $plugin->configSchema(['operation' => $operation]);
     $config = $plugin->config();
     return DrupalConfigHelper::buildFormFromSchema($schema, $config, $parents);
 }