'label' => 'Quiz language',
'type' => 'Locale',
'column' => true,
- 'tab' => 'Texts and translations']);
+ 'tab' => 'Settings']);
+
+ $this->addField([
+ 'name' => 'questions',
+ 'type' => 'BunchOfFieldsMultiple',
+ 'bunch' => 'App\SubForms\Question',
+ 'label' => 'Questions',
+ 'add_label' => 'Add question',
+ 'tab' => 'Questions / Answers',
+ ]);
$colors = [
'mainColor' => ['label' => 'Main color', 'hint' => 'Buttons and rollovers color'],
--- /dev/null
+<?php
+
+
+namespace App\SubForms;
+
+use Cubist\Backpack\app\Magic\SubForm;
+
+class Question extends SubForm
+{
+ public function init()
+ {
+ parent::init();
+
+ $this->addField(['name' => 'question',
+ 'type' => 'Text',
+ 'label' => 'Question']);
+
+ $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',
+ ]);
+ }
+}