diff --git a/core/lib/Drupal/Core/Block/BlockBase.php b/core/lib/Drupal/Core/Block/BlockBase.php index 12b93ea..d06960d 100644 --- a/core/lib/Drupal/Core/Block/BlockBase.php +++ b/core/lib/Drupal/Core/Block/BlockBase.php @@ -277,10 +277,11 @@ public function setTransliteration(TransliterationInterface $transliteration) { * {@inheritdoc} */ public function getFormClass($operation) { - if ($this->hasFormClass($operation)) { - $plugin_definition = $this->getPluginDefinition(); - // Fallback to the class of this plugin if the key is not set. - return isset($plugin_definition['forms'][$operation]) ? $plugin_definition['forms'][$operation] : get_class($this); + if (isset($this->getPluginDefinition()['forms'][$operation])) { + return $this->getPluginDefinition()['forms'][$operation]; + } + elseif ($operation == 'configure' && $this instanceof PluginFormInterface) { + return static::CLASS; } } @@ -288,7 +289,7 @@ public function getFormClass($operation) { * {@inheritdoc} */ public function hasFormClass($operation) { - return isset($this->getPluginDefinition()['forms'][$operation]) || ($operation == 'configure' && $this instanceof PluginFormInterface); + return !empty($this->getFormClass($operation)); } } diff --git a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php index feac004..c0423bc 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php @@ -383,7 +383,6 @@ public function providerTestProcessDefinition() { $data['no_form'][] = ['class' => TestPluginForm::class]; $data['no_form'][] = [ 'class' => TestPluginForm::class, - 'forms' => ['configure' => TestPluginForm::class], 'foo' => ['bar' => ['baz']], ];