Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / taxonomy / src / Plugin / EntityReferenceSelection / TermSelection.php
index b8f4d14fbe1d334b7fcbf8315998f37715b25ae8..a66eaf51c609dd299ee69299bd23f49b89916f99 100644 (file)
@@ -3,7 +3,6 @@
 namespace Drupal\taxonomy\Plugin\EntityReferenceSelection;
 
 use Drupal\Component\Utility\Html;
-use Drupal\Core\Database\Query\SelectInterface;
 use Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\taxonomy\Entity\Vocabulary;
@@ -24,8 +23,13 @@ class TermSelection extends DefaultSelection {
   /**
    * {@inheritdoc}
    */
-  public function entityQueryAlter(SelectInterface $query) {
-    // @todo: How to set access, as vocabulary is now config?
+  public function defaultConfiguration() {
+    return [
+      'sort' => [
+        'field' => 'name',
+        'direction' => 'asc',
+      ]
+    ] + parent::defaultConfiguration();
   }
 
   /**
@@ -49,15 +53,13 @@ class TermSelection extends DefaultSelection {
    */
   public function getReferenceableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0) {
     if ($match || $limit) {
-      $this->configuration['handler_settings']['sort'] = ['field' => 'name', 'direction' => 'asc'];
       return parent::getReferenceableEntities($match, $match_operator, $limit);
     }
 
     $options = [];
 
     $bundles = $this->entityManager->getBundleInfo('taxonomy_term');
-    $handler_settings = $this->configuration['handler_settings'];
-    $bundle_names = !empty($handler_settings['target_bundles']) ? $handler_settings['target_bundles'] : array_keys($bundles);
+    $bundle_names = $this->getConfiguration()['target_bundles'] ?: array_keys($bundles);
 
     foreach ($bundle_names as $bundle) {
       if ($vocabulary = Vocabulary::load($bundle)) {