function workbench_access_form_alter in Workbench Access 7
Same name and namespace in other branches
- 8 workbench_access.module \workbench_access_form_alter()
Implements hook_form_alter().
Alter the options when presenting a node form. Also fire any extension hooks registered with hook_workbench_access_FORM_ID_alter().
File
- ./
workbench_access.module, line 1422 - Workbench Access module file.
Code
function workbench_access_form_alter(&$form, $form_state, $form_id) {
global $user;
// Make sure we prepared the user.
if (!isset($user->workbench_access)) {
workbench_access_user_load_data($user);
}
// Fire any active internal module hooks for non-node forms.
if (empty($form['#node_edit_form'])) {
workbench_access_alter_form($form_id, $form, $form_state);
return;
}
// Fire the node form alter, if there are configured sections.
if (!workbench_access_allow_form_alter()) {
return;
}
// Do not fire if this content type is not under our control.
if (!variable_get('workbench_access_node_type_' . $form['#node']->type, 1)) {
return;
}
// Determine which form element to target.
if (variable_get('workbench_access_custom_form', 1)) {
// Provide a form element.
workbench_access_node_form_element($form, $form_state);
}
else {
workbench_access_default_form_element($form, $form_state);
}
}