]> _ Git - cubist_cms-back.git/commitdiff
done #2840 @0:10
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 17 Jun 2019 12:51:12 +0000 (14:51 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 17 Jun 2019 12:51:12 +0000 (14:51 +0200)
src/app/Magic/Fields/Model.php

index 2b231b40a2de4d1f50865811e8fd7aa67b1fbcc4..0bba06502387f84d1c18772d1a7f4f49c2d9c652 100644 (file)
@@ -6,6 +6,8 @@ namespace Cubist\Backpack\app\Magic\Fields;
 
 class Model extends Field
 {
+    protected static $_options = null;
+
     public function getColumnData()
     {
         $res = parent::getColumnData();
@@ -14,17 +16,20 @@ class Model extends Field
         return $res;
     }
 
-    protected function _postSetAttributes()
-    {
-        parent::_postSetAttributes();
-    }
-
     public function getDefaultAttributes()
     {
         return array_merge(parent::getDefaultAttributes(), ['attribute' => 'name', 'allows_null' => false, 'allows_multiple' => $this->_multiple]);
     }
 
     protected function _getOptions()
+    {
+        if (null === static::$_options) {
+            static::$_options = $this->__getOptions();
+        }
+        return static::$_options;
+    }
+
+    protected function __getOptions()
     {
         $modelClass = $this->getAttribute('optionsmodel');
         $inst = new $modelClass();