You are here

abstract class PluginBase in Backup and Migrate 8.4

Class PluginOperationTrait.

@package BackupMigrate\Core\Plugin

Hierarchy

Expanded class hierarchy of PluginBase

15 files declare their use of PluginBase
CompressionFilter.php in lib/backup_migrate_core/src/Filter/CompressionFilter.php
DatabaseSource.php in lib/backup_migrate_core/src/Source/DatabaseSource.php
DBExcludeFilter.php in lib/backup_migrate_core/src/Filter/DBExcludeFilter.php
DestinationBase.php in lib/backup_migrate_core/src/Destination/DestinationBase.php
DrupalBrowserUploadDestination.php in src/Destination/DrupalBrowserUploadDestination.php

... See full list

File

lib/backup_migrate_core/src/Plugin/PluginBase.php, line 13

Namespace

BackupMigrate\Core\Plugin
View source
abstract class PluginBase implements PluginInterface, ConfigurableInterface {
  use ConfigurableTrait;

  /**
   * Get a list of supported operations and their weight.
   *
   * An array of operations should take the form:
   *
   * [
   *  'backup' => ['weight' => 100],
   *  'restore' => ['weight' => -100],
   * ];
   *
   * @return array
   */
  public function supportedOps() {
    return [];
  }

  /**
   * Does this plugin implement the given operation.
   *
   * @param $op string The name of the operation
   *
   * @return bool
   */
  public function supportsOp($op) {

    // If the function has the method then it supports the op.
    if (method_exists($this, $op)) {
      return TRUE;
    }

    // If the supported ops array contains the op then it is supported.
    $ops = $this
      ->supportedOps();
    return isset($ops[$op]);
  }

  /**
   * What is the weight of the given operation for this plugin.
   *    * @param $op string The name of the operation.
   *
   * @return int
   */
  public function opWeight($op) {
    $ops = $this
      ->supportedOps();
    if (isset($ops[$op]['weight'])) {
      return $ops[$op]['weight'];
    }
    return 0;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigurableTrait::$config protected property The object's configuration object.
ConfigurableTrait::$init protected property The initial configuration. These configuration options can be overriden by the config options but will not be overwritten. If the object is re-configured after construction any missing configuration options will revert to these values.
ConfigurableTrait::confGet public function Get a specific value from the configuration.
ConfigurableTrait::config public function Get the configuration object for this item.
ConfigurableTrait::configDefaults public function Get the default values for the plugin. 10
ConfigurableTrait::configErrors public function Get any validation errors in the config.
ConfigurableTrait::configSchema public function Get a default (blank) schema. 10
ConfigurableTrait::setConfig public function Set the configuration for all plugins. 1
ConfigurableTrait::__construct public function 2
PluginBase::opWeight public function What is the weight of the given operation for this plugin. Overrides PluginInterface::opWeight
PluginBase::supportedOps public function Get a list of supported operations and their weight. Overrides PluginInterface::supportedOps 8
PluginBase::supportsOp public function Does this plugin implement the given operation. Overrides PluginInterface::supportsOp
TranslatableTrait::$translator protected property
TranslatableTrait::setTranslator public function
TranslatableTrait::t public function Translate the given string if there is a translator service available.