Skip to content

Commit

Permalink
Include new flag in languageSettings to completely ignore language fi…
Browse files Browse the repository at this point in the history
…lter and search in all translations.
  • Loading branch information
xserna committed Nov 27, 2024
1 parent 1485af2 commit 5d52677
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/lib/CoreFilter/NativeCoreFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* - prioritized languages fallback
* - always available language fallback
* - main language search
* - optionally ignore language filter, search in all translations
*/
class NativeCoreFilter extends CoreFilter
{
Expand Down Expand Up @@ -104,14 +105,20 @@ public function apply(Query $query, array $languageSettings, $documentTypeIdenti
$excludeTranslationsFromAlwaysAvailable =
$languageSettings['excludeTranslationsFromAlwaysAvailable'] ?? true;

$excludeCoreCriterion =
$languageSettings['excludeCoreCriterion'] ?? false;

$criteria = [
new CustomField(self::FIELD_DOCUMENT_TYPE, Operator::EQ, $documentTypeIdentifier),
$this->getCoreCriterion(
];

if (!$excludeCoreCriterion) {
$criteria[] = $this->getCoreCriterion(
$languages,
$useAlwaysAvailable,
$excludeTranslationsFromAlwaysAvailable
),
];
);
}

if ($query->filter !== null) {
$criteria[] = $query->filter;
Expand Down

0 comments on commit 5d52677

Please sign in to comment.