Updated all the contrib modules to their latest versions.
[yaffs-website] / web / modules / contrib / entityqueue / src / Plugin / views / relationship / EntityQueueRelationship.php
index 6145c9478ab3b08dbc0a5084c341e20cea0eaa47..691a7662b60a36ec928a1a9ef36b1534a98f2f98 100644 (file)
@@ -33,17 +33,17 @@ class EntityQueueRelationship extends EntityReverse implements CacheableDependen
    */
   public function buildOptionsForm(&$form, FormStateInterface $form_state) {
     $queues = EntityQueue::loadMultipleByTargetType($this->getEntityType());
-    $options = array();
+    $options = [];
     foreach ($queues as $queue) {
       $options[$queue->id()] = $queue->label();
     }
 
-    $form['limit_queue'] = array(
+    $form['limit_queue'] = [
       '#type' => 'radios',
       '#title' => $this->t('Limit to a specific entity queue'),
       '#options' => $options,
       '#default_value' => $this->options['limit_queue'],
-    );
+    ];
 
     parent::buildOptionsForm($form, $form_state);
   }
@@ -109,8 +109,6 @@ class EntityQueueRelationship extends EntityReverse implements CacheableDependen
    * {@inheritdoc}
    */
   public function query() {
-    parent::query();
-
     // Add a 'where' condition if needed.
     if (!empty($this->definition['extra'])) {
       $bundles = [];
@@ -121,12 +119,16 @@ class EntityQueueRelationship extends EntityReverse implements CacheableDependen
           $bundles[] = $extra['value'];
         }
       }
-      $this->definition['join_extra'][] = [
-        'field' => 'bundle',
-        'operator' => 'IN',
-        'value' => [$bundles],
-      ];
+      if (count($bundles) > 0) {
+        $this->definition['join_extra'][] = [
+          'field' => 'bundle',
+          'value' => $bundles,
+        ];
+      }
     }
+
+    // Now - let's build the query.
+    parent::query();
   }
 
 }