function pcp_form_field_ui_field_edit_form_alter in Profile Complete Percent 7
Implements hook_form_FORM_ID_alter().
File
- ./
pcp.module, line 492 - Allows users with valid permissions to tag profile fields (core fields or Profile2 fields) for a users profile to be considered complete.
Code
function pcp_form_field_ui_field_edit_form_alter(&$form, &$form_state) {
form_load_include($form_state, 'inc', 'pcp', 'includes/pcp.admin');
// @todo do we need user access check here?
if ($form['#instance']['entity_type'] == 'profile2') {
$tag = FALSE;
$result = pcp_get_tagged_profile_fields($form['#instance']['entity_type'], $form['#instance']['bundle'], $form['#instance']['field_name']);
if (!empty($result)) {
$tag = TRUE;
}
$form['instance']['pcp_tag'] = array(
'#type' => 'checkbox',
'#title' => t('Make required for PCP module'),
'#description' => t('Checking this box will tag this field as a required field for completion of the users profile.'),
'#default_value' => $tag,
'#weight' => -5,
);
$form['#submit'][] = 'pcp_admin_settings_submit';
}
}