Projet

Général

Profil

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

root / drupal7 / sites / all / modules / nodeaccess / nodeaccess.api.php @ c2ac6d1d

1
<?php
2

    
3
/**
4
 * @file
5
 * API documentation for Nodeaccess module.
6
 */
7

    
8

    
9
/**
10
 * Allow for changes to be made on the entire grants array for a node before
11
 * saving.
12
 *
13
 * @param array &$grants
14
 *   array(
15
 *    array(
16
 *      'gid' => (int) gid for realm,
17
 *      'realm' => (string) what realm the access grant belongs to (ex: nodeaccess_rid).
18
 *      'grant_view' => (int) view access being granted,
19
 *      'grant_update' => (int) update access being granted,
20
 *      'grant_delete' => (int) delete access being granted,
21
 *    ),
22
 *    ...
23
 *  )
24
 * @param $node
25
 *   Node object the grant is being applied to.
26
 */
27
function hook_nodeaccess_grants_alter(&$grants, $node) {
28
  foreach ($grants as $gid => $grant) {
29
    // Make some changes to the grants.
30
  }
31
}
32

    
33

    
34
/**
35
 * Allow for changes to be made on the single grant item prior to saving.
36
 *
37
 * @param array &$grant
38
 *  array(
39
 *    'gid' => (int) gid for realm,
40
 *    'realm' => (string) what realm the access grant belongs to (ex: nodeaccess_rid).
41
 *    'grant_view' => (int) view access being granted,
42
 *    'grant_update' => (int) update access being granted,
43
 *    'grant_delete' => (int) delete access being granted,
44
 *  )
45
 * @param $node
46
 *   Node object the grant is being applied to.
47
 */
48
function hook_nodeaccess_grant_alter(&$grant, $node) {
49
  // Make some change to the individual grant.
50
}