19 declare(strict_types=1);
43 $ui = $DIC->ui()->factory();
45 $request = $DIC->http()->request();
47 $txt =
"This allows for a preceding text and longer questions to ask.";
49 $rating = $ui->input()->field()->rating(
"Rate with the Stars:",
"change the rating")
50 ->withAdditionalText(
$txt)
51 ->withValue(FiveStarRatingScale::AVERAGE);
52 $rating_required = $ui->input()->field()->rating(
"Rate with the Stars:",
'this is required')
54 $rating_disabled = $ui->input()->field()->rating(
"Rate with the Stars:",
"this is disabled")
55 ->withValue(FiveStarRatingScale::BAD)
57 $rating_average = $ui->input()->field()->rating(
"Follow the Stars:",
"the little line above shows the current average")
58 ->withValue(FiveStarRatingScale::TERRIBLE)
59 ->withCurrentAverage(3.5);
62 $form = $ui->input()->container()->form()
64 'rating_1' => $rating,
65 'rating_2' => $rating_required,
66 'rating_3' => $rating_disabled,
67 'rating_4' => $rating_average
70 if ($request->getMethod() ==
"POST") {
71 $form = $form->withRequest($request);
72 $result = $form->getData();
74 $result =
"No result yet.";
78 "<pre>" . print_r($result,
true) .
"</pre><br/>" .
FiveStarRatingScale
This is the scale for the Rating Input.