-
- //prefix
- $prefix = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id');
- if (isset($nameFields['Prefix']) && !empty($prefix)) {
- $form->addSelect('prefix_id', array('class' => 'eight', 'placeholder' => ' ', 'label' => ts('Prefix')));
- }
-
- $attributes = CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact');
-
- if (isset($nameFields['Formal Title'])) {
- $form->addElement('text', 'formal_title', ts('Title'), $attributes['formal_title']);
- }
-
- // first_name
- if (isset($nameFields['First Name'])) {
- $form->addElement('text', 'first_name', ts('First Name'), $attributes['first_name']);
+ // Fixme: dear god why? these come out in a format that is NOT the name of the fields.
+ foreach ($nameFields as &$fix) {
+ $fix = str_replace(' ', '_', strtolower($fix));
+ if ($fix == 'prefix' || $fix == 'suffix') {
+ // God, why god?
+ $fix .= '_id';
+ }