_devel_node_access_get_grant_list
- Versions
- 6
_devel_node_access_get_grant_list($nid,$checked_status,$checked_grants)- 7
_devel_node_access_get_grant_list($nid, $ng_alter_data)
Helper function to create a list of the grants returned by hook_node_grants().
Code
contrib/devel/devel_node_access.module, line 1091
<?php
function _devel_node_access_get_grant_list($nid, $ng_alter_data) {
//dpm($ng_alter_data, "_devel_node_access_get_grant_list($nid,");
$ng_alter_data = array_merge(array('all'=> array(0 => array('cur' => TRUE, 'ori' => array('all')))), $ng_alter_data);
$items = array();
if (count($ng_alter_data)) {
foreach ($ng_alter_data as $realm => $gids) {
ksort($gids);
$gs = array();
foreach ($gids as $gid => $history) {
if ($history['cur']) {
if (isset($history['ori'])) {
$g = $gid; // original grant, still active
}
else {
$g = '<u>' . $gid . '</u>'; // new grant, still active
}
}
else {
$g = '<del>' . $gid . '</del>'; // deleted grant
}
$ghs = array();
if (isset($history['ori']) && strpos($realm, $history['ori'][0]) !== 0) {
$ghs[] = 'by ' . $history['ori'][0];
}
if (isset($history['chg'])) {
foreach ($history['chg'] as $h) {
$ghs[] = $h;
}
}
if (!empty($ghs)) {
$g .= ' (' . implode(', ', $ghs) . ')';
}
$gs[] = $g;
}
$items[] = $realm . ': ' . implode(', ', $gs);
}
if (!empty($items)) {
return theme('item_list', array('items' => $items, 'type' => 'ul'));
}
}
}
?>


