function nodeaccess_userreference_form_alter in Node access user reference 5.2
Same name and namespace in other branches
- 5 nodeaccess_userreference.module \nodeaccess_userreference_form_alter()
Implementation of hook_form_alter().
File
- ./
nodeaccess_userreference.module, line 76
Code
function nodeaccess_userreference_form_alter($form_id, &$form) {
if ($form_id == '_content_admin_field' && $form['field_type']['#value'] == "userreference") {
$variable = 'nodeaccess_userreference_' . $form['field_name']['#value'] . '_' . $form['type_name']['#value'];
$data = variable_get($variable, array(
'view' => 0,
'update' => 0,
'delete' => 0,
));
$form['widget']['nodeaccess_userreference_view'] = array(
'#type' => 'checkbox',
'#title' => t('Grant "view" node access to user'),
'#default_value' => $data['view'],
'#description' => t('Give the referenced user access to view the node, if they cannot already do so.'),
'#weight' => 42,
);
$form['widget']['nodeaccess_userreference_update'] = array(
'#type' => 'checkbox',
'#title' => t('Grant "edit" node access to user'),
'#default_value' => $data['update'],
'#description' => t('Give the referenced user access to edit the node, if they cannot already do so.'),
'#weight' => 43,
);
$form['widget']['nodeaccess_userreference_delete'] = array(
'#type' => 'checkbox',
'#title' => t('Grant "delete" node access to user'),
'#default_value' => $data['delete'],
'#description' => t('Give the referenced user access to delete the node, if they cannot already do so.'),
'#weight' => 44,
);
$form['#submit']['nodeaccess_userreference_content_field_edit_form_submit'] = array();
}
}