function protected_node_form_alter in Protected Node 5
Same name and namespace in other branches
- 6 protected_node.module \protected_node_form_alter()
Implementation of hook_form_alter(). @link http://api.drupal.org/api/function/hook_form_alter/5
File
- ./
protected_node.module, line 85
Code
function protected_node_form_alter($form_id, &$form) {
// check if this node type should be protected
if ($form['#id'] == 'node-form' && (user_access('edit protected content') || user_access('edit protected ' . $form['type']['#value']))) {
$form['protected_node'] = array(
'#type' => 'fieldset',
'#description' => t('Here if you check the checkbox and provide a password your newly created node will be password protected.'),
'#title' => t('Protected node'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['protected_node']['is_protected'] = array(
'#type' => 'checkbox',
'#title' => t('Node is protected'),
'#description' => t('Check here if this content should be protected by a password.'),
'#default_value' => $form['#node']->is_protected,
);
$form['protected_node']['was_protected'] = array(
'#type' => 'hidden',
'#default_value' => $form['#node']->was_protected,
);
$form['protected_node']['password'] = array(
'#type' => 'password_confirm',
'#description' => t('Enter the node password here.'),
'#size' => 20,
'#default_value' => $form['#node']->password,
);
}
}