drupal_get_path_map

Versions
4.6
drupal_get_path_map($action = '')

Return an array mapping path aliases to their internal Drupal paths.

▾ 3 functions call drupal_get_path_map()

drupal_get_normal_path in includes/common.inc
Given a path alias, return the internal path it represents.
drupal_get_path_alias in includes/bootstrap.inc
Given an internal Drupal path, return the alias set by the administrator.
drupal_rebuild_path_map in includes/common.inc
Regenerate the path map from the information in the database.

Code

includes/bootstrap.inc, line 353

<?php
function drupal_get_path_map($action = '') {
  static $map = NULL;

  if ($action == 'rebuild') {
    $map = NULL;
  }

  if (is_null($map)) {
    $map = array();  // Make $map non-null in case no aliases are defined.
    $result = db_query('SELECT * FROM {url_alias}');
    while ($data = db_fetch_object($result)) {
      $map[$data->dst] = $data->src;
    }
  }

  return $map;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.