]> git.andy128k.dev Git - ipf.git/commitdiff
correctly pass initial data to model form
authorAndrey Kutejko <andy128k@gmail.com>
Wed, 27 Aug 2014 02:58:40 +0000 (05:58 +0300)
committerAndrey Kutejko <andy128k@gmail.com>
Wed, 27 Aug 2014 02:58:40 +0000 (05:58 +0300)
ipf/admin/legacymodel.php

index d447a173aabb065a0bfab8a144628494a2380b40..99c304f13a526ddb238289f08c6a94bb3ca4cc46 100644 (file)
@@ -165,20 +165,19 @@ class IPF_Admin_Model extends IPF_Admin_Component
 
     protected function _getForm($model, $data)
     {
+        $extra = array(
+            'user_fields' => $this->fields(),
+        );
+
         if ($model) {
             // edit
-            if (!$data)
-                $data = $this->getFormData($model);
+            $extra['model'] = $model;
+            $extra['initial'] = $this->getFormData($model);
         } else {
             // add
-            $model = new $this->modelName;
+            $extra['model'] = new $this->modelName;
         }
 
-        $extra = array(
-            'user_fields' => $this->fields(),
-            'model' => $model,
-        );
-
         return new IPF_Form_Model($data, $extra);
     }