CRM_Admin_Form_Setting - Use Setting.getoptions
authorTim Otten <totten@civicrm.org>
Tue, 18 Aug 2015 00:39:43 +0000 (17:39 -0700)
committerTim Otten <totten@civicrm.org>
Tue, 18 Aug 2015 01:55:48 +0000 (18:55 -0700)
CRM/Admin/Form/Setting.php

index b5cd289c7eec8210472357c72588c716f19102fb..56116fdf0bb49b9bcaeea3f116cb0faefe26fb84 100644 (file)
@@ -144,6 +144,12 @@ class CRM_Admin_Form_Setting extends CRM_Core_Form {
             $props['html_type'] == 'select' ? CRM_Utils_Array::value('html_attributes', $props) : NULL
           );
         }
+        elseif ($add == 'addSelect') {
+          $options = civicrm_api3('Setting', 'getoptions', array(
+            'field' => $setting,
+          ));
+          $this->addElement('select', $setting, ts($props['title']), $options['values'], CRM_Utils_Array::value('html_attributes', $props));
+        }
         else {
           $this->$add($setting, ts($props['title']));
         }
@@ -161,6 +167,10 @@ class CRM_Admin_Form_Setting extends CRM_Core_Form {
     }
   }
 
+  public function getDefaultEntity() {
+    return 'Setting';
+  }
+
   /**
    * Process the form submission.
    */