You are here

public function MongodbPathAliasStorage::lookupPathSource in MongoDB 8

Returns Drupal system URL of an alias.

The default implementation performs case-insensitive matching on the 'source' and 'alias' strings.

Parameters

string $path: The path to investigate for corresponding system URLs.

string $langcode: Language code to search the path with. If there's no path defined for that language it will search paths without language.

Return value

string|false A Drupal system path, or FALSE if no path was found.

Overrides AliasStorageInterface::lookupPathSource

File

src/MongodbPathAliasStorage.php, line 140
Contains Drupal\mongodb\Path.

Class

MongodbPathAliasStorage
Provides a class for CRUD operations on path aliases in MongoDB.

Namespace

Drupal\mongodb

Code

public function lookupPathSource($path, $langcode) {
  if ($aliases = $this
    ->mongodbAliasQuery([
    'alias' => $path,
  ], $langcode, 1)) {
    reset($aliases);
    return key($aliases);
  }
  return FALSE;
}