CRM-19723 - CaseType Config UI improvements: icons, popups, labels
[civicrm-core.git] / CRM / Admin / Form.php
index da05b0a1128fa3a23f5eb47d59946cc0bc339104..cc3186887fcc6cf3cce791421ca49978d3b14808 100644 (file)
@@ -90,6 +90,7 @@ class CRM_Admin_Form extends CRM_Core_Form {
    * @return array
    */
   public function setDefaultValues() {
+    // Fetch defaults from the db
     if (isset($this->_id) && empty($this->_values)) {
       $this->_values = array();
       $params = array('id' => $this->_id);
@@ -98,6 +99,15 @@ class CRM_Admin_Form extends CRM_Core_Form {
     }
     $defaults = $this->_values;
 
+    // Allow defaults to be set from the url
+    if (empty($this->_id) && $this->_action & CRM_Core_Action::ADD) {
+      foreach ($_GET as $key => $val) {
+        if ($this->elementExists($key)) {
+          $defaults[$key] = $val;
+        }
+      }
+    }
+
     if ($this->_action == CRM_Core_Action::DELETE &&
       isset($defaults['name'])
     ) {