You are here

trait PluginCallerTrait in Backup and Migrate 5.0.x

Implements the injection code for a PluginCallerInterface object.

@package Drupal\backup_migrate\Core\Plugin

Hierarchy

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

... See full list

File

src/Core/Plugin/PluginCallerTrait.php, line 10

Namespace

Drupal\backup_migrate\Core\Plugin
View source
trait PluginCallerTrait {

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

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

  /**
   * Get the plugin manager.
   *
   * @return \Drupal\backup_migrate\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.