path.api.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /**
  3. * @file
  4. * Hooks provided by the Path module.
  5. */
  6. /**
  7. * @addtogroup hooks
  8. * @{
  9. */
  10. /**
  11. * Respond to a path being inserted.
  12. *
  13. * @param $path
  14. * An associative array containing the following keys:
  15. * - source: The internal system path.
  16. * - alias: The URL alias.
  17. * - pid: Unique path alias identifier.
  18. * - language: The language of the alias.
  19. *
  20. * @see path_save()
  21. */
  22. function hook_path_insert($path) {
  23. db_insert('mytable')
  24. ->fields(array(
  25. 'alias' => $path['alias'],
  26. 'pid' => $path['pid'],
  27. ))
  28. ->execute();
  29. }
  30. /**
  31. * Respond to a path being updated.
  32. *
  33. * @param $path
  34. * An associative array containing the following keys:
  35. * - source: The internal system path.
  36. * - alias: The URL alias.
  37. * - pid: Unique path alias identifier.
  38. * - language: The language of the alias.
  39. *
  40. * @see path_save()
  41. */
  42. function hook_path_update($path) {
  43. db_update('mytable')
  44. ->fields(array('alias' => $path['alias']))
  45. ->condition('pid', $path['pid'])
  46. ->execute();
  47. }
  48. /**
  49. * Respond to a path being deleted.
  50. *
  51. * @param $path
  52. * An associative array containing the following keys:
  53. * - source: The internal system path.
  54. * - alias: The URL alias.
  55. * - pid: Unique path alias identifier.
  56. * - language: The language of the alias.
  57. *
  58. * @see path_delete()
  59. */
  60. function hook_path_delete($path) {
  61. db_delete('mytable')
  62. ->condition('pid', $path['pid'])
  63. ->execute();
  64. }
  65. /**
  66. * @} End of "addtogroup hooks".
  67. */