]> _ Git - cubist_cms-back.git/commitdiff
wait #3359 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 21 Jan 2020 18:35:25 +0000 (19:35 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 21 Jan 2020 18:35:25 +0000 (19:35 +0100)
src/app/Magic/Fields/SiteVariant.php

index ebb08b6c612fc304d58dd9e0b5d3cca5c57949c9..565d52f130af0595bfdc7536c761921e2dbdae25 100644 (file)
@@ -22,8 +22,16 @@ class SiteVariant extends SelectFromArray
             $attributes['column'] = true;
             $attributes['column_move_after'] = 'id';
             $attributes['options'] = array_combine($variants, $variants);
-            $attributes['default'] = array_values($attributes['options']);
+            $attributes['default'] = array_keys($attributes['options']);
         }
         parent::__construct($attributes);
     }
+
+    public function filterValue($value)
+    {
+        if (null === $value) {
+            $value = $this->getAttribute('default');
+        }
+        return $value;
+    }
 }