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