Преглед на файлове

search form : limit autocomplete by current language

Bachir Soussi Chiadmi преди 6 години
родител
ревизия
dc8a77b761

+ 0 - 1
sites/all/modules/figli/edlp_corpus/src/Controller/CorpusController.php

@@ -35,7 +35,6 @@ class CorpusController extends ControllerBase {
 
     $current_langcode = \Drupal::languageManager()->getCurrentLanguage()->getId();
 
-
     $config = \Drupal::config('system.site');
 
     $query = \Drupal::entityQuery('node')

+ 5 - 1
sites/all/modules/figli/edlp_search/src/Controller/EdlpSearchController.php

@@ -138,6 +138,9 @@ class EdlpSearchController extends ControllerBase {
         ->createInstance('direct');
     $query->setParseMode($parse_mode);
 
+    $current_langcode = \Drupal::languageManager()->getCurrentLanguage()->getId();
+    $query->setLanguages(array($current_langcode));
+
     // $query->range(0, 20);
 
     // workflow
@@ -163,7 +166,7 @@ class EdlpSearchController extends ControllerBase {
 
     $result = $query->execute();
     $items = $result->getResultItems();
-
+    // dpm($items);
     $this->matches = [];
     foreach ($items as $item) {
       // get the field from item
@@ -179,6 +182,7 @@ class EdlpSearchController extends ControllerBase {
         continue;
       }
 
+      // dpm($fields);
       // get field content
       $field_text = $fields[0]->getText();