search form : limit autocomplete by current language
This commit is contained in:
@@ -35,7 +35,6 @@ class CorpusController extends ControllerBase {
|
||||
|
||||
$current_langcode = \Drupal::languageManager()->getCurrentLanguage()->getId();
|
||||
|
||||
|
||||
$config = \Drupal::config('system.site');
|
||||
|
||||
$query = \Drupal::entityQuery('node')
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user