path_save

Versions
4.6
path_save($edit)
7
path_save(&$path)

Save a path alias to the database.

Parameters

$path An associative array containing the following keys:

  • source: The internal system path.
  • alias: The URL alias.
  • pid: (optional) Unique path alias identifier.
  • language: (optional) The language of the alias.

Code

includes/path.inc, line 449

<?php
function path_save(&$path) {
  $path += array('pid' => NULL, 'language' => LANGUAGE_NONE);

  // Insert or update the alias.
  $status = drupal_write_record('url_alias', $path, (!empty($path['pid']) ? 'pid' : NULL));

  // Verify that a record was written.
  if (isset($status) && $status) {
    if ($status === SAVED_NEW) {
      module_invoke_all('path_insert', $path);
    }
    else {
      module_invoke_all('path_update', $path);
    }
    drupal_clear_path_cache();
  }
}
?>
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.