Projet

Général

Profil

Paste
Télécharger (1,45 ko) Statistiques
| Branche: | Révision:

root / drupal7 / modules / path / path.api.php @ 6d8023f2

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 $path
17
 *   An associative array containing the following keys:
18
 *   - source: The internal system path.
19
 *   - alias: The URL alias.
20
 *   - pid: Unique path alias identifier.
21
 *   - language: The language of the alias.
22
 *
23
 * @see path_save()
24
 */
25
function hook_path_insert($path) {
26
  db_insert('mytable')
27
    ->fields(array(
28
      'alias' => $path['alias'],
29
      'pid' => $path['pid'],
30
    ))
31
    ->execute();
32
}
33

    
34
/**
35
 * Respond to a path being updated.
36
 *
37
 * @param $path
38
 *   An associative array containing the following keys:
39
 *   - source: The internal system path.
40
 *   - alias: The URL alias.
41
 *   - pid: Unique path alias identifier.
42
 *   - language: The language of the alias.
43
 *
44
 * @see path_save()
45
 */
46
function hook_path_update($path) {
47
  db_update('mytable')
48
    ->fields(array('alias' => $path['alias']))
49
    ->condition('pid', $path['pid'])
50
    ->execute();
51
}
52

    
53
/**
54
 * Respond to a path being deleted.
55
 *
56
 * @param $path
57
 *   An associative array containing the following keys:
58
 *   - source: The internal system path.
59
 *   - alias: The URL alias.
60
 *   - pid: Unique path alias identifier.
61
 *   - language: The language of the alias.
62
 *
63
 * @see path_delete()
64
 */
65
function hook_path_delete($path) {
66
  db_delete('mytable')
67
    ->condition('pid', $path['pid'])
68
    ->execute();
69
}
70

    
71
/**
72
 * @} End of "addtogroup hooks".
73
 */