function party_primary_fields_edit_field in Party 7
Form constructor for setting primary field sources.
1 string reference to 'party_primary_fields_edit_field'
- party_menu in ./
party.module - Implements hook_menu().
File
- ./
party.admin.inc, line 151 - Admin page callback file for the party module.
Code
function party_primary_fields_edit_field($form, &$form_state, $target) {
// Get some information about this primary field.
$party = entity_create_stub_entity('party', array(
0 => NULL,
2 => 'party',
));
$wrapper = entity_metadata_wrapper('party', $party);
$form['#submit'][] = 'party_primary_fields_edit_field_submit';
$form['#target'] = $target;
$form['#info'] = $wrapper
->getPropertyInfo($target);
$sources = PartyPrimaryFields::getFields($target);
// Set the page title.
drupal_set_title($form['#info']['label']);
$form['sources'] = array(
'#type' => 'fieldset',
'#title' => t('Sources'),
'#target' => $target,
'#parents' => array(
'sources',
),
'#default_value' => $sources,
'#weight' => -1,
);
form_load_include($form_state, 'inc', 'party', 'party.primary_fields');
PartyPrimaryFields::sourceForm($form['sources'], $form_state, $form);
if ($target == 'email') {
$form['options'] = array(
'#type' => 'fieldset',
'#title' => t('Settings'),
);
$form['options']['party_ensure_no_dup_emails'] = array(
'#title' => t('Ensure that Primary Emails are not duplicated'),
'#description' => t('When a Party is about to be saved with a primary email that already exists the email will be unset and a message shown to the user.'),
'#type' => 'checkbox',
'#default_value' => variable_get('party_ensure_no_dup_emails', FALSE),
);
}
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
return $form;
}