From 7db8046256f3bcf50bf6d892761e249ae3c0c19d Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 6 Sep 2023 21:55:55 +0200 Subject: [PATCH] wip #6250 @1 --- app/SubForms/Quiz/Answer.php | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/app/SubForms/Quiz/Answer.php b/app/SubForms/Quiz/Answer.php index b80a42015..a11d251b9 100644 --- a/app/SubForms/Quiz/Answer.php +++ b/app/SubForms/Quiz/Answer.php @@ -4,7 +4,10 @@ namespace App\SubForms\Quiz; use Cubist\Backpack\Magic\Fields\Integer; +use Cubist\Backpack\Magic\Fields\SelectFromArray; +use Cubist\Backpack\Magic\Fields\Textarea; use Cubist\Backpack\Magic\SubForm; + // __('!! e-Learning') class Answer extends SubForm { @@ -14,12 +17,33 @@ class Answer extends SubForm $this->addField(['name' => 'answer', 'type' => 'Text', - 'label' => __('Texte de la réponse') + 'label' => __('Titre de la réponse') + ]); + + $this->addField(['name' => 'answer_text', + 'type' => Textarea::class, + 'label' => __('Texte de la réponse'), + 'when' => ['type' => ['draganddrop']], + ], + ); + + $this->addField(['name' => 'drop_area', + 'type' => SelectFromArray::class, + 'label' => __('Zone'), + 'when' => ['type' => ['draganddrop']], + 'allows_null' => false, + 'default' => '1', + 'options' => [ + '1' => __('Zone :zone (:side)', ['zone' => 1, 'side' => __('gauche')]), + '2' => __('Zone :zone (:side)', ['zone' => 2, 'side' => __('droite')]) + ] ]); $this->addField(['name' => 'correct', 'type' => 'Checkbox', - 'label' => __('Réponse correcte')]); + 'label' => __('Réponse correcte'), + 'when' => ['type' => ['multiple']], + ]); $this->addField(['name' => 'score', 'type' => Integer::class, -- 2.39.5