function user_revision_form_user_profile_form_alter in User Revision 7
Same name and namespace in other branches
- 7.2 user_revision.module \user_revision_form_user_profile_form_alter()
] * Implements hook_form_alter().
File
- ./
user_revision.module, line 268 - Enables user revision.
Code
function user_revision_form_user_profile_form_alter(&$form, &$form_state, $form_id) {
$account = $form_state['user'];
$form['revision_information'] = array(
'#type' => 'fieldset',
'#title' => t('Revision information'),
'#collapsible' => FALSE,
'#attributes' => array(
'class' => array(
'user-profile-form-revision-information',
),
),
'#weight' => 20,
'#access' => user_access('choose user revisions'),
);
$form['revision_information']['revision'] = array(
'#type' => 'checkbox',
'#title' => t('Create new revision'),
'#default_value' => variable_get('user_revision_by_default', 1),
'#states' => array(
'invisible' => array(
'input[name="revision"]' => array(
'checked' => TRUE,
),
),
),
);
$form['revision_information']['log'] = array(
'#type' => 'textarea',
'#title' => t('Revision log message'),
'#rows' => 4,
'#description' => t('Provide an explanation of the changes you are making. This will help other authors understand your motivations.'),
);
$form['revision_information']['log']['#states'] = array(
'invisible' => array(
'input[name="revision"]' => array(
'checked' => FALSE,
),
),
);
$form['#submit'][] = 'user_revision_user_profile_form_submit';
$form['vid'] = array(
'#type' => 'value',
'#value' => isset($account->vid) ? $account->vid : NULL,
);
$form['ip'] = array(
'#type' => 'value',
'#value' => ip_address(),
);
}