Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- declare(strict_types=1);
- namespace App\Components\Trip;
- use DateTime;
- use Model\Trip\Trip;
- use Nette\Application\UI\Form;
- use Nette\Utils\ArrayHash;
- use Tracy\Debugger;
- class TripStopsFormFactory {
- public function create(Trip $trip) {
- $form = new Form();
- $availableStops = [];
- foreach ($trip->getAvailableStops() as $stop) {
- $availableStops[$stop->getId()] = "";
- }
- $form->addText('dateTime', "Date and time of departure");
- $form->addText('numberOfAdults', "Adults (15+)");
- $form->addText('numberOfChildren', "Children (0-14)");
- $form->addText('numberOfLuggage', "Luggage");
- $form->addCheckboxList('selectedStops', "", $availableStops);
- $form->addSubmit('submit', "Proceed");
- $form->onSuccess[] = function (Form $form, ArrayHash $values) {
- Debugger::barDump($values);
- };
- return $form;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement