function AliasRepository::preloadPathAlias
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Path/AliasRepository.php \Drupal\Core\Path\AliasRepository::preloadPathAlias()
- 10 core/modules/path_alias/src/AliasRepository.php \Drupal\path_alias\AliasRepository::preloadPathAlias()
- 11.x core/modules/path_alias/src/AliasRepository.php \Drupal\path_alias\AliasRepository::preloadPathAlias()
Overrides AliasRepositoryInterface::preloadPathAlias
File
-
core/
modules/ path_alias/ src/ AliasRepository.php, line 34
Class
- AliasRepository
- Provides the default path alias lookup operations.
Namespace
Drupal\path_aliasCode
public function preloadPathAlias($preloaded, $langcode) {
$select = $this->getBaseQuery()
->fields('base_table', [
'path',
'alias',
]);
if (!empty($preloaded)) {
$conditions = $this->connection
->condition('OR');
foreach ($preloaded as $preloaded_item) {
$conditions->condition('base_table.path', $this->connection
->escapeLike($preloaded_item), 'LIKE');
}
$select->condition($conditions);
}
$this->addLanguageFallback($select, $langcode);
// We order by ID ASC so that fetchAllKeyed() returns the most recently
// created alias for each source. Subsequent queries using fetchField() must
// use ID DESC to have the same effect.
$select->orderBy('base_table.id', 'ASC');
return $select->execute()
->fetchAllKeyed();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.