diff --git a/core/lib/Drupal/Component/Plugin/ConfigurablePluginInterface.php b/core/lib/Drupal/Component/Plugin/ConfigurablePluginInterface.php index 889199e..94e41c4 100644 --- a/core/lib/Drupal/Component/Plugin/ConfigurablePluginInterface.php +++ b/core/lib/Drupal/Component/Plugin/ConfigurablePluginInterface.php @@ -3,8 +3,40 @@ namespace Drupal\Component\Plugin; /** - * Provides an interface for a configurable plugin with dependencies. + * Provides an interface for a configurable plugin. + * + * In 8.5.?, this was decoupled from + * \Drupal\Component\Plugin\DependentPluginInterface. You must implement both + * interfaces if you want a configurable and dependent plugin. + * + * @see TODO ADD LINK TO CHANGE RECORD HERE * * @ingroup plugin_api */ -interface ConfigurablePluginInterface extends DependentPluginInterface, ConfigurablePluginWithoutDependenciesInterface {} +interface ConfigurablePluginInterface { + + /** + * 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(); + +} diff --git a/core/lib/Drupal/Core/Action/ConfigurableActionBase.php b/core/lib/Drupal/Core/Action/ConfigurableActionBase.php index 3d372fe..0c7f116 100644 --- a/core/lib/Drupal/Core/Action/ConfigurableActionBase.php +++ b/core/lib/Drupal/Core/Action/ConfigurableActionBase.php @@ -3,13 +3,14 @@ namespace Drupal\Core\Action; 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 ConfigurablePluginInterface, PluginFormInterface { +abstract class ConfigurableActionBase extends ActionBase implements ConfigurablePluginInterface, DependentPluginInterface, PluginFormInterface { /** * {@inheritdoc} diff --git a/core/lib/Drupal/Core/Block/BlockPluginInterface.php b/core/lib/Drupal/Core/Block/BlockPluginInterface.php index b3cf88e..bdccf6d 100644 --- a/core/lib/Drupal/Core/Block/BlockPluginInterface.php +++ b/core/lib/Drupal/Core/Block/BlockPluginInterface.php @@ -2,6 +2,7 @@ namespace Drupal\Core\Block; +use Drupal\Component\Plugin\DependentPluginInterface; use Drupal\Component\Plugin\DerivativeInspectionInterface; use Drupal\Core\Cache\CacheableDependencyInterface; use Drupal\Component\Plugin\PluginInspectionInterface; @@ -20,7 +21,7 @@ * * @ingroup block_api */ -interface BlockPluginInterface extends ConfigurablePluginInterface, PluginFormInterface, PluginInspectionInterface, CacheableDependencyInterface, DerivativeInspectionInterface { +interface BlockPluginInterface extends ConfigurablePluginInterface, DependentPluginInterface, PluginFormInterface, PluginInspectionInterface, CacheableDependencyInterface, DerivativeInspectionInterface { /** * Indicates the block label (title) should be displayed to end users. diff --git a/core/lib/Drupal/Core/Condition/ConditionInterface.php b/core/lib/Drupal/Core/Condition/ConditionInterface.php index 40bdf60..d8b76ed 100644 --- a/core/lib/Drupal/Core/Condition/ConditionInterface.php +++ b/core/lib/Drupal/Core/Condition/ConditionInterface.php @@ -3,6 +3,7 @@ namespace Drupal\Core\Condition; 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; @@ -42,7 +43,7 @@ * * @ingroup plugin_api */ -interface ConditionInterface extends ExecutableInterface, PluginFormInterface, ConfigurablePluginInterface, PluginInspectionInterface, CacheableDependencyInterface { +interface ConditionInterface extends ExecutableInterface, PluginFormInterface, ConfigurablePluginInterface, DependentPluginInterface, PluginInspectionInterface, CacheableDependencyInterface { /** * Determines whether condition result will be negated. diff --git a/core/lib/Drupal/Core/Display/VariantInterface.php b/core/lib/Drupal/Core/Display/VariantInterface.php index 20a77f1..5f12864 100644 --- a/core/lib/Drupal/Core/Display/VariantInterface.php +++ b/core/lib/Drupal/Core/Display/VariantInterface.php @@ -3,6 +3,7 @@ namespace Drupal\Core\Display; 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; @@ -16,7 +17,7 @@ * @see \Drupal\Core\Display\VariantManager * @see plugin_api */ -interface VariantInterface extends PluginInspectionInterface, ConfigurablePluginInterface, PluginFormInterface, RefinableCacheableDependencyInterface { +interface VariantInterface extends PluginInspectionInterface, ConfigurablePluginInterface, DependentPluginInterface, PluginFormInterface, RefinableCacheableDependencyInterface { /** * Returns the user-facing display variant label. diff --git a/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginBase.php b/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginBase.php index 1e48a3e..03f4558 100644 --- a/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginBase.php +++ b/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginBase.php @@ -3,6 +3,7 @@ namespace Drupal\Core\Entity\EntityReferenceSelection; 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; @@ -11,7 +12,7 @@ /** * Provides a base class for configurable selection handlers. */ -abstract class SelectionPluginBase extends PluginBase implements SelectionInterface, ConfigurablePluginInterface { +abstract class SelectionPluginBase extends PluginBase implements SelectionInterface, ConfigurablePluginInterface, DependentPluginInterface { /** * Constructs a new selection object. diff --git a/core/lib/Drupal/Core/Layout/LayoutInterface.php b/core/lib/Drupal/Core/Layout/LayoutInterface.php index 32ee74d..c54dbac 100644 --- a/core/lib/Drupal/Core/Layout/LayoutInterface.php +++ b/core/lib/Drupal/Core/Layout/LayoutInterface.php @@ -2,6 +2,7 @@ namespace Drupal\Core\Layout; +use Drupal\Component\Plugin\DependentPluginInterface; use Drupal\Component\Plugin\DerivativeInspectionInterface; use Drupal\Component\Plugin\PluginInspectionInterface; use Drupal\Component\Plugin\ConfigurablePluginInterface; @@ -9,7 +10,7 @@ /** * Provides an interface for static Layout plugins. */ -interface LayoutInterface extends PluginInspectionInterface, DerivativeInspectionInterface, ConfigurablePluginInterface { +interface LayoutInterface extends PluginInspectionInterface, DerivativeInspectionInterface, ConfigurablePluginInterface, DependentPluginInterface { /** * Build a render array for layout with regions. diff --git a/core/modules/aggregator/src/Plugin/AggregatorPluginSettingsBase.php b/core/modules/aggregator/src/Plugin/AggregatorPluginSettingsBase.php index 403e6a3..8e83056 100644 --- a/core/modules/aggregator/src/Plugin/AggregatorPluginSettingsBase.php +++ b/core/modules/aggregator/src/Plugin/AggregatorPluginSettingsBase.php @@ -3,6 +3,7 @@ namespace Drupal\aggregator\Plugin; 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; @@ -19,7 +20,7 @@ * @see \Drupal\aggregator\Plugin\ParserInterface * @see plugin_api */ -abstract class AggregatorPluginSettingsBase extends PluginBase implements PluginFormInterface, ConfigurablePluginInterface { +abstract class AggregatorPluginSettingsBase extends PluginBase implements PluginFormInterface, ConfigurablePluginInterface, DependentPluginInterface { /** * {@inheritdoc} diff --git a/core/modules/filter/src/Plugin/FilterInterface.php b/core/modules/filter/src/Plugin/FilterInterface.php index cdbe276..c4a4f6a 100644 --- a/core/modules/filter/src/Plugin/FilterInterface.php +++ b/core/modules/filter/src/Plugin/FilterInterface.php @@ -2,6 +2,7 @@ namespace Drupal\filter\Plugin; +use Drupal\Component\Plugin\DependentPluginInterface; use Drupal\Component\Plugin\PluginInspectionInterface; use Drupal\Component\Plugin\ConfigurablePluginInterface; use Drupal\Core\Form\FormStateInterface; @@ -75,7 +76,7 @@ * @see \Drupal\filter\Plugin\FilterBase * @see plugin_api */ -interface FilterInterface extends ConfigurablePluginInterface, PluginInspectionInterface { +interface FilterInterface extends ConfigurablePluginInterface, DependentPluginInterface, PluginInspectionInterface { /** * Non-HTML markup language filters that generate HTML. diff --git a/core/modules/image/src/ImageEffectInterface.php b/core/modules/image/src/ImageEffectInterface.php index 7174ae5..549d3e0 100644 --- a/core/modules/image/src/ImageEffectInterface.php +++ b/core/modules/image/src/ImageEffectInterface.php @@ -3,6 +3,7 @@ namespace Drupal\image; use Drupal\Component\Plugin\ConfigurablePluginInterface; +use Drupal\Component\Plugin\DependentPluginInterface; use Drupal\Component\Plugin\PluginInspectionInterface; use Drupal\Core\Image\ImageInterface; @@ -16,7 +17,7 @@ * @see \Drupal\image\ImageEffectManager * @see plugin_api */ -interface ImageEffectInterface extends PluginInspectionInterface, ConfigurablePluginInterface { +interface ImageEffectInterface extends PluginInspectionInterface, ConfigurablePluginInterface, DependentPluginInterface { /** * Applies an image effect to the image object. diff --git a/core/modules/media/src/MediaSourceInterface.php b/core/modules/media/src/MediaSourceInterface.php index 6d08c20..d298c01 100644 --- a/core/modules/media/src/MediaSourceInterface.php +++ b/core/modules/media/src/MediaSourceInterface.php @@ -3,6 +3,7 @@ namespace Drupal\media; 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; @@ -66,7 +67,7 @@ * @see \Drupal\media\MediaSourceFieldConstraintsInterface * @see plugin_api */ -interface MediaSourceInterface extends PluginInspectionInterface, ConfigurablePluginInterface, PluginFormInterface { +interface MediaSourceInterface extends PluginInspectionInterface, ConfigurablePluginInterface, DependentPluginInterface, PluginFormInterface { /** * Default empty value for metadata fields. diff --git a/core/modules/search/src/Plugin/ConfigurableSearchPluginInterface.php b/core/modules/search/src/Plugin/ConfigurableSearchPluginInterface.php index 6bbeecd..0095102 100644 --- a/core/modules/search/src/Plugin/ConfigurableSearchPluginInterface.php +++ b/core/modules/search/src/Plugin/ConfigurableSearchPluginInterface.php @@ -3,12 +3,13 @@ namespace Drupal\search\Plugin; 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 ConfigurablePluginInterface, PluginFormInterface, SearchInterface { +interface ConfigurableSearchPluginInterface extends ConfigurablePluginInterface, DependentPluginInterface, PluginFormInterface, SearchInterface { /** * Sets the ID for the search page using this plugin. diff --git a/core/modules/workflows/src/WorkflowTypeInterface.php b/core/modules/workflows/src/WorkflowTypeInterface.php index 0cb47a4..544e079 100644 --- a/core/modules/workflows/src/WorkflowTypeInterface.php +++ b/core/modules/workflows/src/WorkflowTypeInterface.php @@ -3,13 +3,14 @@ namespace Drupal\workflows; use Drupal\Component\Plugin\ConfigurablePluginInterface; +use Drupal\Component\Plugin\DependentPluginInterface; use Drupal\Component\Plugin\DerivativeInspectionInterface; use Drupal\Core\Plugin\PluginWithFormsInterface; /** * An interface for Workflow type plugins. */ -interface WorkflowTypeInterface extends PluginWithFormsInterface, DerivativeInspectionInterface, ConfigurablePluginInterface { +interface WorkflowTypeInterface extends PluginWithFormsInterface, DerivativeInspectionInterface, ConfigurablePluginInterface, DependentPluginInterface { /** * The key of the global workflow plugin form. diff --git a/core/tests/Drupal/Tests/Core/Plugin/ContextHandlerTest.php b/core/tests/Drupal/Tests/Core/Plugin/ContextHandlerTest.php index 5cf8d9c..4ef89e8 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/ContextHandlerTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/ContextHandlerTest.php @@ -8,6 +8,7 @@ namespace Drupal\Tests\Core\Plugin; use Drupal\Component\Plugin\ConfigurablePluginInterface; +use Drupal\Component\Plugin\DependentPluginInterface; use Drupal\Component\Plugin\Exception\ContextException; use Drupal\Core\Cache\NullBackend; use Drupal\Core\DependencyInjection\ClassResolverInterface; @@ -516,5 +517,5 @@ public function testApplyContextMappingConfigurableAssignedMiss() { } -interface TestConfigurableContextAwarePluginInterface extends ContextAwarePluginInterface, ConfigurablePluginInterface { +interface TestConfigurableContextAwarePluginInterface extends ContextAwarePluginInterface, ConfigurablePluginInterface, DependentPluginInterface { } diff --git a/core/tests/Drupal/Tests/Core/Plugin/DefaultSingleLazyPluginCollectionTest.php b/core/tests/Drupal/Tests/Core/Plugin/DefaultSingleLazyPluginCollectionTest.php index 21bbde8..0560948 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/DefaultSingleLazyPluginCollectionTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/DefaultSingleLazyPluginCollectionTest.php @@ -3,6 +3,7 @@ namespace Drupal\Tests\Core\Plugin; use Drupal\Component\Plugin\ConfigurablePluginInterface; +use Drupal\Component\Plugin\DependentPluginInterface; use Drupal\Component\Plugin\PluginBase; use Drupal\Core\Plugin\DefaultSingleLazyPluginCollection; @@ -71,7 +72,7 @@ public function testGetInstanceIds() { } -class ConfigurablePlugin extends PluginBase implements ConfigurablePluginInterface { +class ConfigurablePlugin extends PluginBase implements ConfigurablePluginInterface, DependentPluginInterface { public function __construct(array $configuration, $plugin_id, $plugin_definition) { parent::__construct($configuration, $plugin_id, $plugin_definition); diff --git a/core/tests/Drupal/Tests/Core/Plugin/Fixtures/TestConfigurablePlugin.php b/core/tests/Drupal/Tests/Core/Plugin/Fixtures/TestConfigurablePlugin.php index 383b4d2..044ab83 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/Fixtures/TestConfigurablePlugin.php +++ b/core/tests/Drupal/Tests/Core/Plugin/Fixtures/TestConfigurablePlugin.php @@ -3,9 +3,10 @@ namespace Drupal\Tests\Core\Plugin\Fixtures; use Drupal\Component\Plugin\ConfigurablePluginInterface; +use Drupal\Component\Plugin\DependentPluginInterface; use Drupal\Component\Plugin\PluginBase; -class TestConfigurablePlugin extends PluginBase implements ConfigurablePluginInterface { +class TestConfigurablePlugin extends PluginBase implements ConfigurablePluginInterface, DependentPluginInterface { /** * {@inheritdoc}