You are here

function backup_migrate_get_service_object in Backup and Migrate 8.4

Same name and namespace in other branches
  1. 5.0.x backup_migrate.module \backup_migrate_get_service_object()

Get a BackupMigrate service object.

Parameters

array $config_array: An array of configuration arrays, keyed by plugin id.

array $options: A keyed array of options.

Return value

\BackupMigrate\Core\Main\BackupMigrate

10 calls to backup_migrate_get_service_object()
BackupMigrateAdvancedBackupForm::buildForm in src/Form/BackupMigrateAdvancedBackupForm.php
Form constructor.
BackupMigrateAdvancedBackupForm::validateForm in src/Form/BackupMigrateAdvancedBackupForm.php
Form validation handler.
BackupMigrateQuickBackupForm::buildForm in src/Form/BackupMigrateQuickBackupForm.php
Form constructor.
BackupMigrateRestoreForm::buildForm in src/Form/BackupMigrateRestoreForm.php
Form constructor.
BackupRestoreForm::buildForm in src/Form/BackupRestoreForm.php

... See full list

File

./backup_migrate.module, line 87
Primary hook implementations for Backup Migrate.

Code

function backup_migrate_get_service_object($config_array = [], $options = []) {
  static $bam = NULL;

  // If the static cached object has not been loaded.
  if ($bam === NULL) {

    // Create the service object.
    $bam = new \BackupMigrate\Core\Main\BackupMigrate();

    // Allow other modules to alter the object.
    \Drupal::moduleHandler()
      ->alter('backup_migrate_service_object', $bam, $options);
  }

  // Set the configuration overrides if any were passed in.
  if ($config_array) {
    $bam
      ->setConfig(new Config($config_array));
  }
  return $bam;
}