2009-10-17 00:52:36 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Hooks provided by the Path module.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @addtogroup hooks
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2012-03-28 18:02:04 +00:00
|
|
|
* Respond to a path being inserted.
|
2009-10-17 00:52:36 +00:00
|
|
|
*
|
|
|
|
* @param $path
|
2010-12-02 00:22:20 +00:00
|
|
|
* An associative array containing the following keys:
|
|
|
|
* - source: The internal system path.
|
|
|
|
* - alias: The URL alias.
|
|
|
|
* - pid: Unique path alias identifier.
|
2012-01-23 02:14:12 +00:00
|
|
|
* - langcode: The language code of the alias.
|
2010-12-02 00:22:20 +00:00
|
|
|
*
|
|
|
|
* @see path_save()
|
2009-10-17 00:52:36 +00:00
|
|
|
*/
|
|
|
|
function hook_path_insert($path) {
|
2010-12-02 00:22:20 +00:00
|
|
|
db_insert('mytable')
|
|
|
|
->fields(array(
|
|
|
|
'alias' => $path['alias'],
|
|
|
|
'pid' => $path['pid'],
|
|
|
|
))
|
|
|
|
->execute();
|
2009-10-17 00:52:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-03-28 18:02:04 +00:00
|
|
|
* Respond to a path being updated.
|
2009-10-17 00:52:36 +00:00
|
|
|
*
|
|
|
|
* @param $path
|
2010-12-02 00:22:20 +00:00
|
|
|
* An associative array containing the following keys:
|
|
|
|
* - source: The internal system path.
|
|
|
|
* - alias: The URL alias.
|
|
|
|
* - pid: Unique path alias identifier.
|
2012-01-23 02:14:12 +00:00
|
|
|
* - langcode: The language code of the alias.
|
2010-12-02 00:22:20 +00:00
|
|
|
*
|
|
|
|
* @see path_save()
|
2009-10-17 00:52:36 +00:00
|
|
|
*/
|
|
|
|
function hook_path_update($path) {
|
2010-12-02 00:22:20 +00:00
|
|
|
db_update('mytable')
|
|
|
|
->fields(array('alias' => $path['alias']))
|
|
|
|
->condition('pid', $path['pid'])
|
|
|
|
->execute();
|
2009-10-17 00:52:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-03-28 18:02:04 +00:00
|
|
|
* Respond to a path being deleted.
|
2009-10-17 00:52:36 +00:00
|
|
|
*
|
|
|
|
* @param $path
|
2010-12-02 00:22:20 +00:00
|
|
|
* An associative array containing the following keys:
|
|
|
|
* - source: The internal system path.
|
|
|
|
* - alias: The URL alias.
|
|
|
|
* - pid: Unique path alias identifier.
|
2012-01-23 02:14:12 +00:00
|
|
|
* - langcode: The language code of the alias.
|
2010-12-02 00:22:20 +00:00
|
|
|
*
|
|
|
|
* @see path_delete()
|
2009-10-17 00:52:36 +00:00
|
|
|
*/
|
|
|
|
function hook_path_delete($path) {
|
2010-12-02 00:22:20 +00:00
|
|
|
db_delete('mytable')
|
|
|
|
->condition('pid', $path['pid'])
|
|
|
|
->execute();
|
2009-10-17 00:52:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @} End of "addtogroup hooks".
|
|
|
|
*/
|