CRM-16178 use addfield in demographics
authorTim Mallezie <tim.mallezie@chiro.be>
Fri, 15 May 2015 19:07:09 +0000 (21:07 +0200)
committerTim Mallezie <tim.mallezie@chiro.be>
Fri, 15 May 2015 19:07:09 +0000 (21:07 +0200)
CRM/Contact/Form/Edit/Demographics.php

index 17f7ff3b0509082cf5ac73776749ade9c550e110..892a26357766f1c756c35db0e485a2278ad068e2 100644 (file)
@@ -47,21 +47,12 @@ class CRM_Contact_Form_Edit_Demographics {
    * @return void
    */
   public static function buildQuickForm(&$form) {
-    // radio button for gender
-    $genderOptions = array();
-    $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id', array('localize' => TRUE));
-    foreach ($gender as $key => $var) {
-      $genderOptions[$key] = $form->createElement('radio', NULL,
-        ts('Gender'), $var, $key,
-        array('id' => "civicrm_gender_{$var}_{$key}")
-      );
-    }
-    $form->addGroup($genderOptions, 'gender_id', ts('Gender'))->setAttribute('allowClear', TRUE);
+    $form->addField('gender_id', array('entity' => 'contact', 'type' => 'Radio', 'allowClear' => TRUE));
 
-    $form->addDate('birth_date', ts('Date of Birth'), FALSE, array('formatType' => 'birth'));
+    $form->addField('birth_date', array('entity' => 'contact', 'formatType' => 'birth'));
 
-    $form->addElement('checkbox', 'is_deceased', NULL, ts('Contact is Deceased'), array('onclick' => "showDeceasedDate()"));
-    $form->addDate('deceased_date', ts('Deceased Date'), FALSE, array('formatType' => 'birth'));
+    $form->addField('is_deceased', array('entity' => 'contact', 'label' => ts('Contact is Deceased'), 'onclick' => "showDeceasedDate()"));
+    $form->addField('deceased_date', array('entity' => 'contact', 'formatType' => 'birth'));
   }
 
   /**