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
{
$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,