Mercurial > hg > isophonics-drupal-site
annotate core/modules/path/path.api.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | af1871eacc83 |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 |
Chris@0 | 3 /** |
Chris@0 | 4 * @file |
Chris@0 | 5 * Hooks provided by the Path module. |
Chris@0 | 6 */ |
Chris@0 | 7 |
Chris@0 | 8 /** |
Chris@0 | 9 * @addtogroup hooks |
Chris@0 | 10 * @{ |
Chris@0 | 11 */ |
Chris@0 | 12 |
Chris@0 | 13 /** |
Chris@0 | 14 * Respond to a path being inserted. |
Chris@0 | 15 * |
Chris@0 | 16 * @param array $path |
Chris@0 | 17 * The array structure is identical to that of the return value of |
Chris@14 | 18 * \Drupal\Core\Path\AliasStorageInterface::save(). |
Chris@0 | 19 * |
Chris@14 | 20 * @see \Drupal\Core\Path\AliasStorageInterface::save() |
Chris@0 | 21 */ |
Chris@0 | 22 function hook_path_insert($path) { |
Chris@0 | 23 db_insert('mytable') |
Chris@0 | 24 ->fields([ |
Chris@0 | 25 'alias' => $path['alias'], |
Chris@0 | 26 'pid' => $path['pid'], |
Chris@0 | 27 ]) |
Chris@0 | 28 ->execute(); |
Chris@0 | 29 } |
Chris@0 | 30 |
Chris@0 | 31 /** |
Chris@0 | 32 * Respond to a path being updated. |
Chris@0 | 33 * |
Chris@0 | 34 * @param array $path |
Chris@0 | 35 * The array structure is identical to that of the return value of |
Chris@14 | 36 * \Drupal\Core\Path\AliasStorageInterface::save(). |
Chris@0 | 37 * |
Chris@14 | 38 * @see \Drupal\Core\Path\AliasStorageInterface::save() |
Chris@0 | 39 */ |
Chris@0 | 40 function hook_path_update($path) { |
Chris@0 | 41 if ($path['alias'] != $path['original']['alias']) { |
Chris@0 | 42 db_update('mytable') |
Chris@0 | 43 ->fields(['alias' => $path['alias']]) |
Chris@0 | 44 ->condition('pid', $path['pid']) |
Chris@0 | 45 ->execute(); |
Chris@0 | 46 } |
Chris@0 | 47 } |
Chris@0 | 48 |
Chris@0 | 49 /** |
Chris@0 | 50 * Respond to a path being deleted. |
Chris@0 | 51 * |
Chris@0 | 52 * @param array $path |
Chris@0 | 53 * The array structure is identical to that of the return value of |
Chris@14 | 54 * \Drupal\Core\Path\AliasStorageInterface::save(). |
Chris@0 | 55 * |
Chris@14 | 56 * @see \Drupal\Core\Path\AliasStorageInterface::delete() |
Chris@0 | 57 */ |
Chris@0 | 58 function hook_path_delete($path) { |
Chris@0 | 59 db_delete('mytable') |
Chris@0 | 60 ->condition('pid', $path['pid']) |
Chris@0 | 61 ->execute(); |
Chris@0 | 62 } |
Chris@0 | 63 |
Chris@0 | 64 /** |
Chris@0 | 65 * @} End of "addtogroup hooks". |
Chris@0 | 66 */ |