diff --git a/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginBase.php b/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginBase.php index 6e04dcd..0dcbd54 100644 --- a/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginBase.php +++ b/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginBase.php @@ -22,7 +22,6 @@ * The plugin_id for the plugin instance. * @param mixed $plugin_definition * The plugin implementation definition. - * The current user. */ public function __construct(array $configuration, $plugin_id, $plugin_definition) { parent::__construct($configuration, $plugin_id, $plugin_definition); @@ -35,7 +34,6 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition public function defaultConfiguration() { return [ 'target_type' => NULL, - 'handler' => NULL, 'handler_settings' => $this->defaultHandlerSettings(), ]; } @@ -68,6 +66,7 @@ public function calculateDependencies() { * Returns the default handler settings. * * @return array + * An associative array of selection handler settings. * * @todo Add this to SelectionInterface in Drupal 9.0.x. */ diff --git a/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionTrait.php b/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionTrait.php index 16eead0..1d7947d 100644 --- a/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionTrait.php +++ b/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionTrait.php @@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; /** - * Provides common methods and inject services for core selection handlers. + * Provides common methods and injects services for core selection handlers. */ trait SelectionTrait { diff --git a/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php b/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php index 4064e15..e2ff031 100644 --- a/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php +++ b/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php @@ -47,6 +47,7 @@ public function defaultHandlerSettings() { 'target_bundles' => NULL, 'sort' => [ 'field' => '_none', + 'direction' => 'ASC', ], 'auto_create' => FALSE, 'auto_create_bundle' => NULL, @@ -142,11 +143,6 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta ); if ($selection_handler_settings['sort']['field'] != '_none') { - // Merge-in default values. - $selection_handler_settings['sort'] += array( - 'direction' => 'ASC', - ); - $form['sort']['settings']['direction'] = array( '#type' => 'select', '#title' => $this->t('Sort direction'), diff --git a/core/modules/user/src/Plugin/EntityReferenceSelection/UserSelection.php b/core/modules/user/src/Plugin/EntityReferenceSelection/UserSelection.php index 2b0e411..e5015f0 100644 --- a/core/modules/user/src/Plugin/EntityReferenceSelection/UserSelection.php +++ b/core/modules/user/src/Plugin/EntityReferenceSelection/UserSelection.php @@ -86,7 +86,7 @@ public function defaultHandlerSettings() { return [ 'filter' => [ 'type' => '_none', - ], + 'role' => NULL, ], 'include_anonymous' => TRUE, ] + parent::defaultHandlerSettings(); } @@ -123,11 +123,6 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta ); if ($selection_handler_settings['filter']['type'] == 'role') { - // Merge in default values. - $selection_handler_settings['filter'] += array( - 'role' => NULL, - ); - $form['filter']['settings']['role'] = array( '#type' => 'checkboxes', '#title' => $this->t('Restrict to the selected roles'),