Add Filter for Site Multilanguage

Created on 15 October 2018, over 5 years ago
Updated 28 April 2024, about 2 months ago

Hi, this module is great, practice and easy use.
But I found that it's not multilanguage, the filter is correct but change of language I always get same result.

How I can fixup?

I don't want report how a issue, else how a new requeriment or upgrade.

I hope my comment is helpful.

Thanks!

✨ Feature request
Status

Active

Version

2.0

Component

Miscellaneous

Created by

🇦🇷Argentina lcaraves

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇫🇷France anou Collonges au Mont d'Or

    Hello,

    searching to filter search results by language, I had hard time to find the right "TAG" for the search exclude query. I put here my solution to filter the search results by language using search_exclude module:

    In a [MY–MODULE].module file:

    use Drupal\Core\Database\Query\AlterableInterface;
    /**
     * Implements hook_query_TAG_alter(): tag search_$type with $type search_exclude_node_search
     * the TAG part = search_search_exclude_node_search (!!!)
     * 
     *  @return Search results in current language
     */
    function [MY–MODULE]_query_search_search_exclude_node_search_alter(AlterableInterface $query) {
      $language = \Drupal::languageManager()->getCurrentLanguage()->getId();
      $query->condition('n.langcode', $language, '=');
    }
    

    Once you find the TAG, so simple :-)

Production build 0.69.0 2024