You are here

function protected_node_form_alter in Protected Node 6

Same name and namespace in other branches
  1. 5 protected_node.module \protected_node_form_alter()

Implementation of hook_form_alter(). @link http://api.drupal.org/api/function/hook_form_alter/6

Add the protected node form widgets assuming the user editing this node as permission to do so on this type of node.

Turn off the auto-complete feature on this form since it could otherwise pre-fill the password with the wrong parameter.

@param[in,out] $form The form to alter @param[in,out] $form_state The current state of the form @param[in] $form_id The name of the form being modified

File

./protected_node.module, line 368

Code

function protected_node_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'node_type_form' && isset($form['identity']['type'])) {
    module_load_include('settings.inc', 'protected_node');
    protected_node_node_type_form_alter($form);
  }
  elseif (isset($form['type']['#value']) && $form['#id'] == 'node-form' && (user_access('edit any password') || user_access('edit ' . $form['type']['#value'] . ' password'))) {
    module_load_include('settings.inc', 'protected_node');
    protected_node_node_form_alter($form);
  }
}