function path_load
Fetches a specific URL alias from the database.
Parameters
$conditions: A string representing the source, a number representing the pid, or an array of query conditions.
Return value
FALSE if no alias was found or an associative array containing the following keys:
- source: The internal system path.
- alias: The URL alias.
- pid: Unique path alias identifier.
- language: The language of the alias.
5 calls to path_load()
- PathLookupTest::testDrupalLookupPath in modules/
simpletest/ tests/ path.test - Test that drupal_lookup_path() returns the correct path.
- path_delete in includes/
path.inc - Delete a URL alias.
- path_form_node_form_alter in modules/
path/ path.module - Implements hook_form_BASE_FORM_ID_alter() for node_form().
- path_form_taxonomy_form_term_alter in modules/
path/ path.module - Implements hook_form_FORM_ID_alter() for taxonomy_form_term().
- path_save in includes/
path.inc - Save a path alias to the database.
File
-
includes/
path.inc, line 404
Code
function path_load($conditions) {
if (is_numeric($conditions)) {
$conditions = array(
'pid' => $conditions,
);
}
elseif (is_string($conditions)) {
$conditions = array(
'source' => $conditions,
);
}
elseif (!is_array($conditions)) {
return FALSE;
}
$select = db_select('url_alias');
foreach ($conditions as $field => $value) {
$select->condition($field, $value);
}
return $select->fields('url_alias')
->orderBy('pid', 'DESC')
->range(0, 1)
->execute()
->fetchAssoc();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.