You are here

abstract class ScannerPluginBase in Search and Replace Scanner 8

Plugin for ScannerPluginBase class.

Hierarchy

Expanded class hierarchy of ScannerPluginBase

1 file declares its use of ScannerPluginBase
Entity.php in src/Plugin/Scanner/Entity.php

File

src/Plugin/ScannerPluginBase.php, line 13

Namespace

Drupal\scanner\Plugin
View source
abstract class ScannerPluginBase extends PluginBase implements ScannerPluginInterface {
  use StringTranslationTrait;

  /**
   * The temp store we use to store form values.
   *
   * @var Drupal\Core\TempStore\PrivateTempStoreFactory
   */
  protected $tempStore;

  /**
   * The scanner plugin manager.
   *
   * @var Drupal\scanner\Plugin\ScannerPluginManager
   */
  protected $scannerManager;

  /**
   * Constructs a ScannerPluginBase object.
   *
   * @param array $configuration
   *   The configuration.
   * @param string $plugin_id
   *   The plugin id.
   * @param mixed $plugin_definition
   *   The plugin definition.
   * @param \Drupal\Core\TempStore\PrivateTempStoreFactory $tempStore
   *   The temporary store.
   * @param \Drupal\scanner\Plugin\ScannerPluginManager $scannerManager
   *   The scanner manager.
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition, PrivateTempStoreFactory $tempStore, ScannerPluginManager $scannerManager) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->tempStore = $tempStore;
    $this->scannerManager = $scannerManager;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static($configuration, $plugin_id, $plugin_definition, $container
      ->get('tempstore.private'), $container
      ->get('plugin.manager.scanner'));
  }

  /**
   * Performs the search operation and returns the results.
   *
   * @param string $field
   *   The fully qualified name of the field (entityType:bundle:fieldname).
   * @param string $values
   *   The input values from the form ($form_state values).
   *
   * @return array
   *   An array containing the entity titles and an array of matches in the
   *   entity.
   */
  public abstract function search($field, array $values);

  /**
   * Performs the replace operation and returns the results;.
   *
   * @param string $field
   *   The fully qualified name of the field (entityType:bundle:fieldname).
   * @param string $values
   *   The input values from the form ($form_state values).
   * @param array $undo_data
   *   The array for data values.
   *
   * @return array
   *   An array containing both the old and new revision IDs for each affected
   *   entity.
   */
  public abstract function replace($field, array $values, array $undo_data);

  /**
   * Performs the undo operation.
   *
   * @param array $data
   *   An array containing the old and new revision id for the enttiy.
   */
  public abstract function undo(array $data);

}

Members

Namesort descending Modifiers Type Description Overrides
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
ScannerPluginBase::$scannerManager protected property The scanner plugin manager.
ScannerPluginBase::$tempStore protected property The temp store we use to store form values.
ScannerPluginBase::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create
ScannerPluginBase::replace abstract public function Performs the replace operation and returns the results;. Overrides ScannerPluginInterface::replace 1
ScannerPluginBase::search abstract public function Performs the search operation and returns the results. Overrides ScannerPluginInterface::search 1
ScannerPluginBase::undo abstract public function Performs the undo operation. Overrides ScannerPluginInterface::undo 1
ScannerPluginBase::__construct public function Constructs a ScannerPluginBase object. Overrides PluginBase::__construct
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.