Mercurial > hg > isophonics-drupal-site
annotate core/lib/Drupal/Component/Plugin/PluginHelper.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | af1871eacc83 |
children |
rev | line source |
---|---|
Chris@18 | 1 <?php |
Chris@18 | 2 |
Chris@18 | 3 namespace Drupal\Component\Plugin; |
Chris@18 | 4 |
Chris@18 | 5 /** |
Chris@18 | 6 * A helper class to determine if a plugin is configurable. |
Chris@18 | 7 * |
Chris@18 | 8 * Because configurable plugins in Drupal 8 might implement either the |
Chris@18 | 9 * deprecated ConfigurablePluginInterface or the new ConfigurableInterface, |
Chris@18 | 10 * this static method is provided so that a calling class can determine if a |
Chris@18 | 11 * plugin is configurable without checking it against a deprecated interface. |
Chris@18 | 12 * In Drupal 9, this check should be reduced to checking for |
Chris@18 | 13 * ConfigurableInterface only and be deprecated in favor of calling classes |
Chris@18 | 14 * checking against the interface directly. |
Chris@18 | 15 */ |
Chris@18 | 16 class PluginHelper { |
Chris@18 | 17 |
Chris@18 | 18 /** |
Chris@18 | 19 * Determines if a plugin is configurable. |
Chris@18 | 20 * |
Chris@18 | 21 * @param mixed $plugin |
Chris@18 | 22 * The plugin to check. |
Chris@18 | 23 * |
Chris@18 | 24 * @return bool |
Chris@18 | 25 * A boolean indicating whether the plugin is configurable. |
Chris@18 | 26 */ |
Chris@18 | 27 public static function isConfigurable($plugin) { |
Chris@18 | 28 return $plugin instanceof ConfigurableInterface || $plugin instanceof ConfigurablePluginInterface; |
Chris@18 | 29 } |
Chris@18 | 30 |
Chris@18 | 31 } |