comparison 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
comparison
equal deleted inserted replaced
4:a9cd425dd02b 5:12f9dff5fda9
28 28
29 /** 29 /**
30 * Configuration information passed into the plugin. 30 * Configuration information passed into the plugin.
31 * 31 *
32 * When using an interface like 32 * When using an interface like
33 * \Drupal\Component\Plugin\ConfigurablePluginInterface, this is where the 33 * \Drupal\Component\Plugin\ConfigurableInterface, this is where the
34 * configuration should be stored. 34 * configuration should be stored.
35 * 35 *
36 * Plugin configuration is optional, so plugin implementations must provide 36 * Plugin configuration is optional, so plugin implementations must provide
37 * their own setters and getters. 37 * their own setters and getters.
38 * 38 *
52 */ 52 */
53 public function __construct(array $configuration, $plugin_id, $plugin_definition) { 53 public function __construct(array $configuration, $plugin_id, $plugin_definition) {
54 $this->configuration = $configuration; 54 $this->configuration = $configuration;
55 $this->pluginId = $plugin_id; 55 $this->pluginId = $plugin_id;
56 $this->pluginDefinition = $plugin_definition; 56 $this->pluginDefinition = $plugin_definition;
57
58 if ($this instanceof ConfigurablePluginInterface && !$this instanceof ConfigurableInterface) {
59 @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);
60 }
57 } 61 }
58 62
59 /** 63 /**
60 * {@inheritdoc} 64 * {@inheritdoc}
61 */ 65 */
91 */ 95 */
92 public function getPluginDefinition() { 96 public function getPluginDefinition() {
93 return $this->pluginDefinition; 97 return $this->pluginDefinition;
94 } 98 }
95 99
100 /**
101 * Determines if the plugin is configurable.
102 *
103 * @return bool
104 * A boolean indicating whether the plugin is configurable.
105 */
106 public function isConfigurable() {
107 return $this instanceof ConfigurableInterface || $this instanceof ConfigurablePluginInterface;
108 }
109
96 } 110 }