Unverified Commit 267ccab7 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3081145 by Berdir, andypost, longwave, catch, tim.plunkett, larowlan:...

Issue #3081145 by Berdir, andypost, longwave, catch, tim.plunkett, larowlan: Remove BC layers in the Plugin component
parent 0281f2ff
Loading
Loading
Loading
Loading
+0 −45
Original line number Diff line number Diff line
<?php

namespace Drupal\Component\Plugin;

/**
 * Provides an interface for a configurable plugin.
 *
 * @deprecated Drupal\Component\Plugin\ConfigurablePluginInterface is deprecated
 * in Drupal 8.7.0 and will be removed before Drupal 9.0.0. You should implement
 * ConfigurableInterface and/or DependentPluginInterface directly as needed. If
 * you implement ConfigurableInterface you may choose to implement
 * ConfigurablePluginInterface in Drupal 8 as well for maximum compatibility,
 * however this must be removed prior to Drupal 9.
 *
 * @see https://www.drupal.org/node/2946161
 *
 * @ingroup plugin_api
 */
interface ConfigurablePluginInterface extends DependentPluginInterface {

  /**
   * Gets this plugin's configuration.
   *
   * @return array
   *   An array of this plugin's configuration.
   */
  public function getConfiguration();

  /**
   * Sets the configuration for this plugin instance.
   *
   * @param array $configuration
   *   An associative array containing the plugin's configuration.
   */
  public function setConfiguration(array $configuration);

  /**
   * Gets default configuration for this plugin.
   *
   * @return array
   *   An associative array with the default configuration.
   */
  public function defaultConfiguration();

}
+0 −26
Original line number Diff line number Diff line
@@ -20,19 +20,6 @@ abstract class ContextAwarePluginBase extends PluginBase implements ContextAware
   */
  protected $context = [];

  /**
   * Data objects representing the contexts passed in the plugin configuration.
   *
   * @var \Drupal\Component\Plugin\Context\ContextInterface[]
   *
   * @deprecated
   *   in drupal:8.8.0 and is removed from drupal:9.0.0. Use
   *   \Drupal\Component\Plugin\ContextAwarePluginInterface instead.
   *
   * @see https://www.drupal.org/project/drupal/issues/3080631
   */
  private $contexts = [];

  /**
   * Overrides \Drupal\Component\Plugin\PluginBase::__construct().
   *
@@ -56,19 +43,6 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
    parent::__construct($configuration, $plugin_id, $plugin_definition);

    $this->context = $this->createContextFromConfiguration($context_configuration);
    // @todo Remove $this->contexts in Drupal 9; see
    // https://www.drupal.org/project/drupal/issues/3081145
    $this->contexts = $this->context;
  }

  /**
   * Implements magic __get() method.
   */
  public function __get($name) {
    if ($name === 'contexts') {
      @trigger_error('The $contexts property is deprecated in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Use methods of \Drupal\Component\Plugin\ContextAwarePluginInterface instead. See https://www.drupal.org/project/drupal/issues/3080631 for more information.', E_USER_DEPRECATED);
      return $this->contexts;
    }
  }

  /**
+1 −5
Original line number Diff line number Diff line
@@ -54,10 +54,6 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
    $this->configuration = $configuration;
    $this->pluginId = $plugin_id;
    $this->pluginDefinition = $plugin_definition;

    if ($this instanceof ConfigurablePluginInterface && !$this instanceof ConfigurableInterface) {
      @trigger_error('Drupal\Component\Plugin\ConfigurablePluginInterface is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. You should implement ConfigurableInterface and/or DependentPluginInterface directly as needed. If you implement ConfigurableInterface you may choose to implement ConfigurablePluginInterface in Drupal 8 as well for maximum compatibility, however this must be removed prior to Drupal 9. See https://www.drupal.org/node/2946161', E_USER_DEPRECATED);
    }
  }

  /**
@@ -104,7 +100,7 @@ public function getPluginDefinition() {
   *   A boolean indicating whether the plugin is configurable.
   */
  public function isConfigurable() {
    return $this instanceof ConfigurableInterface || $this instanceof ConfigurablePluginInterface;
    return $this instanceof ConfigurableInterface;
  }

}
+2 −8
Original line number Diff line number Diff line
@@ -5,13 +5,7 @@
/**
 * A helper class to determine if a plugin is configurable.
 *
 * Because configurable plugins in Drupal 8 might implement either the
 * deprecated ConfigurablePluginInterface or the new ConfigurableInterface,
 * this static method is provided so that a calling class can determine if a
 * plugin is configurable without checking it against a deprecated interface.
 * In Drupal 9, this check should be reduced to checking for
 * ConfigurableInterface only and be deprecated in favor of calling classes
 * checking against the interface directly.
 * @todo Deprecate this class. https://www.drupal.org/node/3105685
 */
class PluginHelper {

@@ -25,7 +19,7 @@ class PluginHelper {
   *   A boolean indicating whether the plugin is configurable.
   */
  public static function isConfigurable($plugin) {
    return $plugin instanceof ConfigurableInterface || $plugin instanceof ConfigurablePluginInterface;
    return $plugin instanceof ConfigurableInterface;
  }

}
+1 −2
Original line number Diff line number Diff line
@@ -3,7 +3,6 @@
namespace Drupal\Core\Action;

use Drupal\Component\Plugin\ConfigurableInterface;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Drupal\Component\Plugin\DependentPluginInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\PluginFormInterface;
@@ -11,7 +10,7 @@
/**
 * Provides a base implementation for a configurable Action plugin.
 */
abstract class ConfigurableActionBase extends ActionBase implements ConfigurableInterface, DependentPluginInterface, ConfigurablePluginInterface, PluginFormInterface {
abstract class ConfigurableActionBase extends ActionBase implements ConfigurableInterface, DependentPluginInterface, PluginFormInterface {

  /**
   * {@inheritdoc}
Loading