comparison core/lib/Drupal/Component/Plugin/PluginHelper.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents
children
comparison
equal deleted inserted replaced
4:a9cd425dd02b 5:12f9dff5fda9
1 <?php
2
3 namespace Drupal\Component\Plugin;
4
5 /**
6 * A helper class to determine if a plugin is configurable.
7 *
8 * Because configurable plugins in Drupal 8 might implement either the
9 * deprecated ConfigurablePluginInterface or the new ConfigurableInterface,
10 * this static method is provided so that a calling class can determine if a
11 * plugin is configurable without checking it against a deprecated interface.
12 * In Drupal 9, this check should be reduced to checking for
13 * ConfigurableInterface only and be deprecated in favor of calling classes
14 * checking against the interface directly.
15 */
16 class PluginHelper {
17
18 /**
19 * Determines if a plugin is configurable.
20 *
21 * @param mixed $plugin
22 * The plugin to check.
23 *
24 * @return bool
25 * A boolean indicating whether the plugin is configurable.
26 */
27 public static function isConfigurable($plugin) {
28 return $plugin instanceof ConfigurableInterface || $plugin instanceof ConfigurablePluginInterface;
29 }
30
31 }