function AliasRepository::addLanguageFallback
Adds path alias language fallback conditions to a select query object.
Parameters
\Drupal\Core\Database\Query\SelectInterface $query: A Select query object.
string $langcode: Language code to search the path with. If there's no path defined for that language it will search paths without language.
3 calls to AliasRepository::addLanguageFallback()
- AliasRepository::lookupByAlias in core/lib/ Drupal/ Core/ Path/ AliasRepository.php 
- Searches a path alias for a given alias.
- AliasRepository::lookupBySystemPath in core/lib/ Drupal/ Core/ Path/ AliasRepository.php 
- Searches a path alias for a given Drupal system path.
- AliasRepository::preloadPathAlias in core/lib/ Drupal/ Core/ Path/ AliasRepository.php 
- Pre-loads path alias information for a given list of system paths.
File
- 
              core/lib/ Drupal/ Core/ Path/ AliasRepository.php, line 137 
Class
- AliasRepository
- Provides the default path alias lookup operations.
Namespace
Drupal\Core\PathCode
protected function addLanguageFallback(SelectInterface $query, $langcode) {
  // Always get the language-specific alias before the language-neutral one.
  // For example 'de' is less than 'und' so the order needs to be ASC, while
  // 'xx-lolspeak' is more than 'und' so the order needs to be DESC.
  $langcode_list = [
    $langcode,
    LanguageInterface::LANGCODE_NOT_SPECIFIED,
  ];
  if ($langcode === LanguageInterface::LANGCODE_NOT_SPECIFIED) {
    array_pop($langcode_list);
  }
  elseif ($langcode > LanguageInterface::LANGCODE_NOT_SPECIFIED) {
    $query->orderBy('base_table.langcode', 'DESC');
  }
  else {
    $query->orderBy('base_table.langcode', 'ASC');
  }
  $query->condition('base_table.langcode', $langcode_list, 'IN');
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
