lib/CoreFilter/NativeCoreFilter.php
private function getCoreCriterion(array $languageCodes, $useAlwaysAvailable)
    {
        // Handle languages if given
        if (!empty($languageCodes)) {
            // Get condition for prioritized languages fallback
            $filter = $this->getLanguageFilter($languageCodes);

            // Handle always available fallback if used
            if ($useAlwaysAvailable) {
                // Combine conditions with OR
                $filter = new LogicalOr(
                    array(
                        $filter,
                        $this->getAlwaysAvailableFilter($languageCodes),
                    )
                );
            }

            // Return languages condition
            return $filter;
        }

        // Otherwise search only main languages
        return new CustomField(self::FIELD_IS_MAIN_LANGUAGE, Operator::EQ, true);
    }
private function getCoreCriterion(array $languageCodes, $useAlwaysAvailable)
    {
        // Handle languages if given
        if (!empty($languageCodes)) {
            // Get condition for prioritized languages fallback
            $filter = $this->getLanguageFilter($languageCodes);

            // Handle always available fallback if used
            if ($useAlwaysAvailable) {
                // Combine conditions with OR
                $filter = new LogicalOr(
                    array(
                        $filter,
                        $this->getAlwaysAvailableFilter($languageCodes),
                    )
                );
            }

            // Return languages condition
            return $filter;
        }

        // Otherwise search only main languages
        return new CustomField(self::FIELD_IS_MAIN_LANGUAGE, Operator::EQ, true);
    }
Returns a filtering condition for the given language settings.

The condition ensures the same Content will be matched only once across all
targeted translation endpoints.

@param string[] $languageCodes
@param bool $useAlwaysAvailable

@return \eZ\Publish\API\Repository\Values\Content\Query\Criterion