You are here

abstract class PluginBase in Backup and Migrate 5.0.x

@package Drupal\backup_migrate\Core\Plugin

Hierarchy

Expanded class hierarchy of PluginBase

14 files declare their use of PluginBase
CompressionFilter.php in src/Core/Filter/CompressionFilter.php
DatabaseSource.php in src/Core/Source/DatabaseSource.php
DBExcludeFilter.php in src/Core/Filter/DBExcludeFilter.php
DestinationBase.php in src/Core/Destination/DestinationBase.php
DrupalBrowserUploadDestination.php in src/Drupal/Destination/DrupalBrowserUploadDestination.php

... See full list

File

src/Core/Plugin/PluginBase.php, line 13

Namespace

Drupal\backup_migrate\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 string $op
   *   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 string $op
   *   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.
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.