Skip to content
Snippets Groups Projects
Commit 547069e5 authored by Jess's avatar Jess
Browse files

Revert "Issue #2946122 by mikelutz, heddn, tim.plunkett, phenaproxima,...

Revert "Issue #2946122 by mikelutz, heddn, tim.plunkett, phenaproxima, alexpott, MegaChriz, joachim: Deprecate ConfigurablePluginInterface and replace with an interface that doesn't extend DependentPluginInterface"

This reverts commit b1f49624.
parent b332b279
No related branches found
No related tags found
No related merge requests found
Showing
with 28 additions and 106 deletions
......@@ -1382,8 +1382,7 @@
* instantiated. Usually this interface will extend one or more of the
* following interfaces:
* - \Drupal\Component\Plugin\PluginInspectionInterface
* - \Drupal\Component\Plugin\ConfigurableInterface
* - \Drupal\Component\Plugin\DependentPluginInterface
* - \Drupal\Component\Plugin\ConfigurablePluginInterface
* - \Drupal\Component\Plugin\ContextAwarePluginInterface
* - \Drupal\Core\Plugin\PluginFormInterface
* - \Drupal\Core\Executable\ExecutableInterface
......
<?php
namespace Drupal\Component\Plugin;
/**
* Provides an interface for a configurable plugin.
*
* @ingroup plugin_api
*/
interface ConfigurableInterface {
/**
* 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();
}
......@@ -5,15 +5,6 @@
/**
* 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 {
......
......@@ -30,7 +30,7 @@ abstract class PluginBase implements PluginInspectionInterface, DerivativeInspec
* Configuration information passed into the plugin.
*
* When using an interface like
* \Drupal\Component\Plugin\ConfigurableInterface, this is where the
* \Drupal\Component\Plugin\ConfigurablePluginInterface, this is where the
* configuration should be stored.
*
* Plugin configuration is optional, so plugin implementations must provide
......@@ -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);
}
}
/**
......@@ -97,14 +93,4 @@ public function getPluginDefinition() {
return $this->pluginDefinition;
}
/**
* Determines if the plugin is configurable.
*
* @return bool
* A boolean indicating whether the plugin is configurable.
*/
public function isConfigurable() {
return $this instanceof ConfigurableInterface || $this instanceof ConfigurablePluginInterface;
}
}
......@@ -2,16 +2,14 @@
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;
/**
* 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 ConfigurablePluginInterface, PluginFormInterface {
/**
* {@inheritdoc}
......
......@@ -2,12 +2,10 @@
namespace Drupal\Core\Block;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Drupal\Component\Plugin\DerivativeInspectionInterface;
use Drupal\Core\Cache\CacheableDependencyInterface;
use Drupal\Component\Plugin\PluginInspectionInterface;
use Drupal\Component\Plugin\ConfigurableInterface;
use Drupal\Component\Plugin\DependentPluginInterface;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\PluginFormInterface;
use Drupal\Core\Session\AccountInterface;
......@@ -22,7 +20,7 @@
*
* @ingroup block_api
*/
interface BlockPluginInterface extends ConfigurableInterface, DependentPluginInterface, ConfigurablePluginInterface, PluginFormInterface, PluginInspectionInterface, CacheableDependencyInterface, DerivativeInspectionInterface {
interface BlockPluginInterface extends ConfigurablePluginInterface, PluginFormInterface, PluginInspectionInterface, CacheableDependencyInterface, DerivativeInspectionInterface {
/**
* Indicates the block label (title) should be displayed to end users.
......
......@@ -2,9 +2,7 @@
namespace Drupal\Core\Condition;
use Drupal\Component\Plugin\ConfigurableInterface;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Drupal\Component\Plugin\DependentPluginInterface;
use Drupal\Component\Plugin\PluginInspectionInterface;
use Drupal\Core\Cache\CacheableDependencyInterface;
use Drupal\Core\Executable\ExecutableInterface;
......@@ -44,7 +42,7 @@
*
* @ingroup plugin_api
*/
interface ConditionInterface extends ExecutableInterface, PluginFormInterface, ConfigurableInterface, DependentPluginInterface, ConfigurablePluginInterface, PluginInspectionInterface, CacheableDependencyInterface {
interface ConditionInterface extends ExecutableInterface, PluginFormInterface, ConfigurablePluginInterface, PluginInspectionInterface, CacheableDependencyInterface {
/**
* Determines whether condition result will be negated.
......
......@@ -2,9 +2,7 @@
namespace Drupal\Core\Display;
use Drupal\Component\Plugin\ConfigurableInterface;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Drupal\Component\Plugin\DependentPluginInterface;
use Drupal\Component\Plugin\PluginInspectionInterface;
use Drupal\Core\Cache\RefinableCacheableDependencyInterface;
use Drupal\Core\Plugin\PluginFormInterface;
......@@ -18,7 +16,7 @@
* @see \Drupal\Core\Display\VariantManager
* @see plugin_api
*/
interface VariantInterface extends PluginInspectionInterface, ConfigurableInterface, DependentPluginInterface, ConfigurablePluginInterface, PluginFormInterface, RefinableCacheableDependencyInterface {
interface VariantInterface extends PluginInspectionInterface, ConfigurablePluginInterface, PluginFormInterface, RefinableCacheableDependencyInterface {
/**
* Returns the user-facing display variant label.
......
......@@ -2,9 +2,7 @@
namespace Drupal\Core\Entity\EntityReferenceSelection;
use Drupal\Component\Plugin\ConfigurableInterface;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Drupal\Component\Plugin\DependentPluginInterface;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Database\Query\SelectInterface;
use Drupal\Core\Form\FormStateInterface;
......@@ -13,7 +11,7 @@
/**
* Provides a base class for configurable selection handlers.
*/
abstract class SelectionPluginBase extends PluginBase implements SelectionInterface, ConfigurableInterface, DependentPluginInterface, ConfigurablePluginInterface {
abstract class SelectionPluginBase extends PluginBase implements SelectionInterface, ConfigurablePluginInterface {
/**
* Constructs a new selection object.
......
......@@ -9,7 +9,7 @@
* Interface definition for plugin with settings.
*
* @deprecated in Drupal 8.1.0 and will be removed before Drupal 9.0.0. Use
* \Drupal\Component\Plugin\ConfigurableInterface instead.
* \Drupal\Component\Plugin\ConfigurablePluginInterface instead.
*/
interface PluginSettingsInterface extends PluginInspectionInterface, ThirdPartySettingsInterface {
......
......@@ -2,16 +2,14 @@
namespace Drupal\Core\Layout;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Drupal\Component\Plugin\DerivativeInspectionInterface;
use Drupal\Component\Plugin\PluginInspectionInterface;
use Drupal\Component\Plugin\ConfigurableInterface;
use Drupal\Component\Plugin\DependentPluginInterface;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
/**
* Provides an interface for static Layout plugins.
*/
interface LayoutInterface extends PluginInspectionInterface, DerivativeInspectionInterface, ConfigurableInterface, DependentPluginInterface, ConfigurablePluginInterface {
interface LayoutInterface extends PluginInspectionInterface, DerivativeInspectionInterface, ConfigurablePluginInterface {
/**
* Build a render array for layout with regions.
......
......@@ -2,6 +2,7 @@
namespace Drupal\Core\Plugin;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Drupal\Component\Plugin\ContextAwarePluginBase as ComponentContextAwarePluginBase;
use Drupal\Component\Plugin\Exception\ContextException;
use Drupal\Core\Cache\Cache;
......@@ -77,7 +78,7 @@ public function setContextValue($name, $value) {
* {@inheritdoc}
*/
public function getContextMapping() {
$configuration = $this->isConfigurable() ? $this->getConfiguration() : $this->configuration;
$configuration = $this instanceof ConfigurablePluginInterface ? $this->getConfiguration() : $this->configuration;
return isset($configuration['context_mapping']) ? $configuration['context_mapping'] : [];
}
......@@ -85,7 +86,7 @@ public function getContextMapping() {
* {@inheritdoc}
*/
public function setContextMapping(array $context_mapping) {
if ($this->isConfigurable()) {
if ($this instanceof ConfigurablePluginInterface) {
$configuration = $this->getConfiguration();
$configuration['context_mapping'] = array_filter($context_mapping);
$this->setConfiguration($configuration);
......
......@@ -5,6 +5,7 @@
use Drupal\Component\Plugin\Exception\PluginNotFoundException;
use Drupal\Component\Plugin\LazyPluginCollection;
use Drupal\Component\Plugin\PluginManagerInterface;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
/**
......@@ -111,7 +112,7 @@ public function getConfiguration() {
$this->instanceIDs = $this->originalOrder + $current_order;
foreach ($this as $instance_id => $instance) {
if ($instance->isConfigurable()) {
if ($instance instanceof ConfigurablePluginInterface) {
$instances[$instance_id] = $instance->getConfiguration();
}
else {
......@@ -157,7 +158,7 @@ public function setConfiguration($configuration) {
public function setInstanceConfiguration($instance_id, array $configuration) {
$this->configurations[$instance_id] = $configuration;
$instance = $this->get($instance_id);
if ($instance->isConfigurable()) {
if ($instance instanceof ConfigurablePluginInterface) {
$instance->setConfiguration($configuration);
}
}
......
......@@ -4,6 +4,7 @@
use Drupal\Component\Plugin\PluginManagerInterface;
use Drupal\Component\Plugin\LazyPluginCollection;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
/**
......@@ -66,7 +67,7 @@ protected function initializePlugin($instance_id) {
*/
public function getConfiguration() {
$plugin = $this->get($this->instanceId);
if ($plugin && $plugin->isConfigurable()) {
if ($plugin instanceof ConfigurablePluginInterface) {
return $plugin->getConfiguration();
}
else {
......@@ -80,7 +81,7 @@ public function getConfiguration() {
public function setConfiguration($configuration) {
$this->configuration = $configuration;
$plugin = $this->get($this->instanceId);
if ($plugin && $plugin->isConfigurable()) {
if ($plugin instanceof ConfigurablePluginInterface) {
$plugin->setConfiguration($configuration);
}
return $this;
......
......@@ -2,9 +2,7 @@
namespace Drupal\aggregator\Plugin;
use Drupal\Component\Plugin\ConfigurableInterface;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Drupal\Component\Plugin\DependentPluginInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\PluginBase;
use Drupal\Core\Plugin\PluginFormInterface;
......@@ -21,7 +19,7 @@
* @see \Drupal\aggregator\Plugin\ParserInterface
* @see plugin_api
*/
abstract class AggregatorPluginSettingsBase extends PluginBase implements PluginFormInterface, ConfigurableInterface, DependentPluginInterface, ConfigurablePluginInterface {
abstract class AggregatorPluginSettingsBase extends PluginBase implements PluginFormInterface, ConfigurablePluginInterface {
/**
* {@inheritdoc}
......
......@@ -2,10 +2,8 @@
namespace Drupal\filter\Plugin;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Drupal\Component\Plugin\PluginInspectionInterface;
use Drupal\Component\Plugin\ConfigurableInterface;
use Drupal\Component\Plugin\DependentPluginInterface;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Drupal\Core\Form\FormStateInterface;
/**
......@@ -77,7 +75,7 @@
* @see \Drupal\filter\Plugin\FilterBase
* @see plugin_api
*/
interface FilterInterface extends ConfigurableInterface, DependentPluginInterface, ConfigurablePluginInterface, PluginInspectionInterface {
interface FilterInterface extends ConfigurablePluginInterface, PluginInspectionInterface {
/**
* Non-HTML markup language filters that generate HTML.
......
......@@ -2,9 +2,7 @@
namespace Drupal\image;
use Drupal\Component\Plugin\ConfigurableInterface;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Drupal\Component\Plugin\DependentPluginInterface;
use Drupal\Component\Plugin\PluginInspectionInterface;
use Drupal\Core\Image\ImageInterface;
......@@ -18,7 +16,7 @@
* @see \Drupal\image\ImageEffectManager
* @see plugin_api
*/
interface ImageEffectInterface extends PluginInspectionInterface, ConfigurableInterface, DependentPluginInterface, ConfigurablePluginInterface {
interface ImageEffectInterface extends PluginInspectionInterface, ConfigurablePluginInterface {
/**
* Applies an image effect to the image object.
......
......@@ -2,9 +2,7 @@
namespace Drupal\media;
use Drupal\Component\Plugin\ConfigurableInterface;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Drupal\Component\Plugin\DependentPluginInterface;
use Drupal\Component\Plugin\PluginInspectionInterface;
use Drupal\Core\Entity\Display\EntityFormDisplayInterface;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
......@@ -68,7 +66,7 @@
* @see \Drupal\media\MediaSourceFieldConstraintsInterface
* @see plugin_api
*/
interface MediaSourceInterface extends PluginInspectionInterface, ConfigurableInterface, DependentPluginInterface, ConfigurablePluginInterface, PluginFormInterface {
interface MediaSourceInterface extends PluginInspectionInterface, ConfigurablePluginInterface, PluginFormInterface {
/**
* Default empty value for metadata fields.
......
......@@ -2,15 +2,13 @@
namespace Drupal\search\Plugin;
use Drupal\Component\Plugin\ConfigurableInterface;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Drupal\Component\Plugin\DependentPluginInterface;
use Drupal\Core\Plugin\PluginFormInterface;
/**
* Provides an interface for a configurable Search plugin.
*/
interface ConfigurableSearchPluginInterface extends ConfigurableInterface, DependentPluginInterface, ConfigurablePluginInterface, PluginFormInterface, SearchInterface {
interface ConfigurableSearchPluginInterface extends ConfigurablePluginInterface, PluginFormInterface, SearchInterface {
/**
* Sets the ID for the search page using this plugin.
......
......@@ -7,6 +7,7 @@
use Drupal\Core\Entity\EntityWithPluginCollectionInterface;
use Drupal\system\ActionConfigEntityInterface;
use Drupal\Core\Action\ActionPluginCollection;
use Drupal\Component\Plugin\ConfigurablePluginInterface;
/**
* Defines the configured action entity.
......@@ -132,7 +133,7 @@ public function execute(array $entities) {
* {@inheritdoc}
*/
public function isConfigurable() {
return $this->getPlugin()->isConfigurable();
return $this->getPlugin() instanceof ConfigurablePluginInterface;
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment