function simple_access_form_row in Simple Access 6.2
Same name and namespace in other branches
- 5.2 simple_access.module \simple_access_form_row()
- 7.2 simple_access.module \simple_access_form_row()
2 calls to simple_access_form_row()
File
- ./
simple_access.module, line 444 - This module allows administrators to make nodes viewable by specific 'access groups'. Each access group can contain any number of roles. If a node is not assigned to any access groups, it will remain viewable by all users.
Code
function simple_access_form_row($gid, $group, $access, $admin = FALSE) {
if ($admin) {
$variable = array(
'view' => 1,
'update' => 1,
'delete' => 1,
);
}
else {
$variable = variable_get('sa_display', array(
'view' => 1,
'update' => 0,
'delete' => 0,
));
}
$defaults = array(
'sa_view' => NULL,
'sa_update' => NULL,
'sa_delete' => NULL,
);
if (empty($access[$gid])) {
$access[$gid] = $defaults;
}
else {
$access[$gid] += $defaults;
}
$priv = $group['access'] || user_access('administer nodes');
$form = array(
'#access' => $priv,
);
if ($admin) {
$form['#admin'] = $admin;
}
$form['name'] = array(
'#value' => $group['name'],
'#access' => $priv,
);
$form['sa_view'] = array(
'#type' => 'checkbox',
'#default_value' => $access[$gid]['sa_view'],
'#access' => $priv && $variable['view'],
);
$form['sa_update'] = array(
'#type' => 'checkbox',
'#default_value' => $access[$gid]['sa_update'],
'#access' => $priv && $variable['update'],
);
$form['sa_delete'] = array(
'#type' => 'checkbox',
'#default_value' => $access[$gid]['sa_delete'],
'#access' => $priv && $variable['delete'],
);
return $form;
}