Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / path / path.api.php
1 <?php
2
3 /**
4  * @file
5  * Hooks provided by the Path module.
6  */
7
8 /**
9  * @addtogroup hooks
10  * @{
11  */
12
13 /**
14  * Respond to a path being inserted.
15  *
16  * @param array $path
17  *   The array structure is identical to that of the return value of
18  *   \Drupal\Core\Path\PathInterface::save().
19  *
20  * @see \Drupal\Core\Path\PathInterface::save()
21  */
22 function hook_path_insert($path) {
23   db_insert('mytable')
24     ->fields([
25       'alias' => $path['alias'],
26       'pid' => $path['pid'],
27     ])
28     ->execute();
29 }
30
31 /**
32  * Respond to a path being updated.
33  *
34  * @param array $path
35  *   The array structure is identical to that of the return value of
36  *   \Drupal\Core\Path\PathInterface::save().
37  *
38  * @see \Drupal\Core\Path\PathInterface::save()
39  */
40 function hook_path_update($path) {
41   if ($path['alias'] != $path['original']['alias']) {
42     db_update('mytable')
43       ->fields(['alias' => $path['alias']])
44       ->condition('pid', $path['pid'])
45       ->execute();
46   }
47 }
48
49 /**
50  * Respond to a path being deleted.
51  *
52  * @param array $path
53  *   The array structure is identical to that of the return value of
54  *   \Drupal\Core\Path\PathInterface::save().
55  *
56  * @see \Drupal\Core\Path\PathInterface::delete()
57  */
58 function hook_path_delete($path) {
59   db_delete('mytable')
60     ->condition('pid', $path['pid'])
61     ->execute();
62 }
63
64 /**
65  * @} End of "addtogroup hooks".
66  */