diff core/lib/Drupal/Component/Plugin/PluginBase.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents a9cd425dd02b
children
line wrap: on
line diff
--- a/core/lib/Drupal/Component/Plugin/PluginBase.php	Thu Feb 28 13:11:55 2019 +0000
+++ b/core/lib/Drupal/Component/Plugin/PluginBase.php	Thu May 09 15:34:47 2019 +0100
@@ -30,7 +30,7 @@
    * Configuration information passed into the plugin.
    *
    * When using an interface like
-   * \Drupal\Component\Plugin\ConfigurablePluginInterface, this is where the
+   * \Drupal\Component\Plugin\ConfigurableInterface, this is where the
    * configuration should be stored.
    *
    * Plugin configuration is optional, so plugin implementations must provide
@@ -54,6 +54,10 @@
     $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);
+    }
   }
 
   /**
@@ -93,4 +97,14 @@
     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;
+  }
+
 }