You are here

trait PluginCallerTrait in Backup and Migrate 8.4

Class PluginCallerTrait.

@package BackupMigrate\Core\Plugin

Implements the injection code for a PluginCallerInterface object.

Hierarchy

6 files declare their use of PluginCallerTrait
BackupMigrate.php in lib/backup_migrate_core/src/Main/BackupMigrate.php
BrowserDownloadDestination.php in lib/backup_migrate_core/src/Destination/BrowserDownloadDestination.php
FileDirectorySource.php in lib/backup_migrate_core/src/Source/FileDirectorySource.php
MetadataWriter.php in lib/backup_migrate_core/src/Filter/MetadataWriter.php
MySQLiSource.php in lib/backup_migrate_core/src/Source/MySQLiSource.php

... See full list

File

lib/backup_migrate_core/src/Plugin/PluginCallerTrait.php, line 14

Namespace

BackupMigrate\Core\Plugin
View source
trait PluginCallerTrait {

  /**
   * @var \BackupMigrate\Core\Plugin\PluginManagerInterface;
   */
  protected $plugins;

  /**
   * Inject the plugin manager.
   *
   * @param \BackupMigrate\Core\Plugin\PluginManagerInterface $plugins
   */
  public function setPluginManager(PluginManagerInterface $plugins) {
    $this->plugins = $plugins;
  }

  /**
   * Get the plugin manager.
   *
   * @return \BackupMigrate\Core\Plugin\PluginManagerInterface
   */
  public function plugins() {

    // Return the list of plugins or a blank placeholder.
    return $this->plugins ? $this->plugins : new PluginManager();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PluginCallerTrait::$plugins protected property
PluginCallerTrait::plugins public function Get the plugin manager.
PluginCallerTrait::setPluginManager public function Inject the plugin manager.