public function AliasStorage::load in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Path/AliasStorage.php \Drupal\Core\Path\AliasStorage::load()
Fetches a specific URL alias from the database.
The default implementation performs case-insensitive matching on the 'source' and 'alias' strings.
Parameters
array $conditions: An array of query conditions.
Return value
array|false FALSE if no alias was found or an associative array containing the following keys:
- source (string): The internal system path with a starting slash.
- alias (string): The URL alias with a starting slash.
- pid (int): Unique path alias identifier.
- langcode (string): The language code of the alias.
Overrides AliasStorageInterface::load
1 call to AliasStorage::load()
- AliasStorage::delete in core/
lib/ Drupal/ Core/ Path/ AliasStorage.php - Deletes a URL alias.
File
- core/
lib/ Drupal/ Core/ Path/ AliasStorage.php, line 103 - Contains \Drupal\Core\Path\AliasStorage.
Class
- AliasStorage
- Provides a class for CRUD operations on path aliases.
Namespace
Drupal\Core\PathCode
public function load($conditions) {
$select = $this->connection
->select('url_alias');
foreach ($conditions as $field => $value) {
if ($field == 'source' || $field == 'alias') {
// Use LIKE for case-insensitive matching.
$select
->condition($field, $this->connection
->escapeLike($value), 'LIKE');
}
else {
$select
->condition($field, $value);
}
}
return $select
->fields('url_alias')
->orderBy('pid', 'DESC')
->range(0, 1)
->execute()
->fetchAssoc();
}