diff --git a/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginBase.php b/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginBase.php index dfa20f4..8635755 100644 --- a/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginBase.php +++ b/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginBase.php @@ -79,11 +79,8 @@ public function setConfiguration(array $configuration) { // ... // - setting_N // @todo Remove 'handler' and 'handler_settings' in Drupal 9.0.x. - if (array_key_exists('handler_settings', $this->configuration)) { - $this->configuration = NestedArray::mergeDeep([ - $this->configuration, - $this->configuration['handler_settings'] - ]); + if (array_key_exists('handler_settings', $this->configuration) && is_array($this->configuration['handler_settings'])) { + $this->configuration = $this->configuration['handler_settings'] + $this->configuration; } // Sync back 'handler_settings'. foreach ($this->configuration as $key => $value) { diff --git a/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php b/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php index dab9f30..f041727 100644 --- a/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php +++ b/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php @@ -214,7 +214,7 @@ public static function elementValidateFilter(&$element, FormStateInterface $form * {@inheritdoc} */ public function getReferenceableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0) { - $target_type = $this->configuration['target_type']; + $target_type = $this->getConfiguration()['target_type']; $query = $this->buildEntityQuery($match, $match_operator); if ($limit > 0) { diff --git a/core/modules/system/src/Tests/Entity/EntityReferenceSelection/EntityReferenceSelectionAccessTest.php b/core/modules/system/src/Tests/Entity/EntityReferenceSelection/EntityReferenceSelectionAccessTest.php index a46fe36..b7dd8c0 100644 --- a/core/modules/system/src/Tests/Entity/EntityReferenceSelection/EntityReferenceSelectionAccessTest.php +++ b/core/modules/system/src/Tests/Entity/EntityReferenceSelection/EntityReferenceSelectionAccessTest.php @@ -316,7 +316,11 @@ public function testUserHandler() { ); $this->assertReferenceable($selection_options, $referenceable_tests, 'User handler (admin)'); - // Test the 'include_anonymous' option. + // Test the 'include_anonymous' option. This option is intentionally passed + // in the backward compatibility 'handler_settings' key to test also that + // plugin options passed in this way take precedence over the others, in the + // root. In this case the value of FALSE will override the initial value of + // 'include_anonymous' even that was declared in root of configuration. $selection_options['handler_settings']['include_anonymous'] = FALSE; $referenceable_tests = array( array(