You are here

protected function PluginManager::_configurePlugin in Backup and Migrate 8.4

Set the configuration for the given plugin.

Parameters

$plugin:

$id:

2 calls to PluginManager::_configurePlugin()
PluginManager::setConfig in lib/backup_migrate_core/src/Plugin/PluginManager.php
Set the configuration. Reconfigure all of the installed plugins.
PluginManager::_preparePlugin in lib/backup_migrate_core/src/Plugin/PluginManager.php
Prepare the plugin for use. This is called when a plugin is added to the manager and it configures the plugin according to the config object injected into the manager. It also injects other dependencies as needed.

File

lib/backup_migrate_core/src/Plugin/PluginManager.php, line 161

Class

PluginManager
Class PluginManager.

Namespace

BackupMigrate\Core\Plugin

Code

protected function _configurePlugin(PluginInterface $plugin, $id) {

  // If this plugin can be configured, then pass in the configuration.
  if ($plugin instanceof ConfigurableInterface) {

    // Configure the plugin with the appropriate subset of the configuration.
    $config = $this
      ->confGet($id);

    // Set the config for the plugin.
    $plugin
      ->setConfig(new Config($config));

    // Get the configuration back from the plugin to populate defaults within the manager.
    $this
      ->config()
      ->set($id, $plugin
      ->config());
  }
}