diff --git a/core/lib/Drupal/Component/Plugin/Definition/PluginDefinitionInterface.php b/core/lib/Drupal/Component/Plugin/Definition/PluginDefinitionInterface.php new file mode 100644 index 0000000..1132bb5 --- /dev/null +++ b/core/lib/Drupal/Component/Plugin/Definition/PluginDefinitionInterface.php @@ -0,0 +1,38 @@ +getClass()) { throw new PluginException($missing_class_message); } @@ -100,8 +101,8 @@ public static function getPluginClass($plugin_id, $plugin_definition = NULL, $re throw new PluginException(sprintf('Plugin (%s) instance class "%s" does not exist.', $plugin_id, $class)); } - if ($required_interface && !is_subclass_of($plugin_definition['class'], $required_interface)) { - throw new PluginException(sprintf('Plugin "%s" (%s) must implement interface %s.', $plugin_id, $plugin_definition['class'], $required_interface)); + if ($required_interface && !is_subclass_of($class, $required_interface)) { + throw new PluginException(sprintf('Plugin "%s" (%s) must implement interface %s.', $plugin_id, $class, $required_interface)); } return $class; diff --git a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php index 1a3805e..731644c 100644 --- a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php @@ -6,6 +6,7 @@ */ namespace Drupal\Core\Entity; +use Drupal\Component\Plugin\Definition\PluginDefinitionInterface; /** * Provides an interface for an entity type and its metadata. @@ -15,7 +16,7 @@ * implemented to alter existing data and fill-in defaults. Module-specific * properties should be documented in the hook implementations defining them. */ -interface EntityTypeInterface { +interface EntityTypeInterface extends PluginDefinitionInterface { /** * The maximum length of ID, in characters. @@ -67,14 +68,6 @@ public function id(); public function getProvider(); /** - * Gets the name of the entity type class. - * - * @return string - * The name of the entity type class. - */ - public function getClass(); - - /** * Gets the name of the original entity type class. * * In case the class name was changed with setClass(), this will return