]> _ Git - QuizFactory.git/commitdiff
wip #3438
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 28 Feb 2020 20:09:36 +0000 (21:09 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 28 Feb 2020 20:09:36 +0000 (21:09 +0100)
app/SubForms/Answer.php [new file with mode: 0644]
app/SubForms/Question.php

diff --git a/app/SubForms/Answer.php b/app/SubForms/Answer.php
new file mode 100644 (file)
index 0000000..50fa0f2
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+
+namespace App\SubForms;
+
+use Cubist\Backpack\app\Magic\SubForm;
+
+class Answer extends SubForm
+{
+    public function init()
+    {
+        parent::init();
+
+        $this->addField(['name' => 'answer',
+            'type' => 'Text',
+            'label' => 'Answer label']);
+
+        $this->addField(['name' => 'answer',
+            'type' => 'Checkbox',
+            'label' => 'Correct']);
+    }
+}
index 50877e3b032bc10eccf9e6a8bce5ed1abd8ea473..3e3917c6ed649160528a088333a70dd502c0bbc8 100644 (file)
@@ -15,19 +15,35 @@ class Question extends SubForm
             'type' => 'Text',
             'label' => 'Question']);
 
+        $this->addField(['name' => 'explaination',
+            'type' => 'Textarea',
+            'label' => 'Explanation / Answer details',
+            'hint' => 'Text displayed at review time']);
+
         $this->addField(['name' => 'multiple',
             'type' => 'Checkbox',
             'label' => 'Multiple answers']);
 
-        $this->addField([
-            'name' => 'answers',
-            'type' => 'Table',
-            'entity_singular' => 'answer',
-            'columns' => [
-                'answer' => 'Answer label',
-                'correct' => 'Correct',
-            ],
-            'label' => 'Answers',
-        ]);
+//        $this->addField([
+//            'name' => 'answers',
+//            'type' => 'Table',
+//            'entity_singular' => 'answer',
+//            'columns' => [
+//                'answer' => 'Answer label',
+//                'correct' => 'Correct',
+//            ],
+//            'label' => 'Answers',
+//        ]);
+
+
+//        $this->addField([
+//            'name' => 'questions',
+//            'type' => 'BunchOfFieldsMultiple',
+//            'bunch' => 'App\SubForms\Answer',
+//            'label' => 'Questions',
+//            'add_label' => 'Add question',
+//            'tab' => 'Questions / Answers',
+//        ]);
+
     }
 }