Base example showing how to plug a radio into a form.
6{
7
9 $ui =
$DIC->ui()->factory();
10 $renderer =
$DIC->ui()->renderer();
11 $request =
$DIC->http()->request();
12
13
14 $radio = $ui->input()->field()->radio("Radio", "check an option")
15 ->withOption('value1', 'label1', 'byline1')
16 ->withOption('10', 'numeric value (ten)', 'byline2')
17 ->withOption('030', 'not-numeric value', 'byline3');
18
19
20 $form = $ui->input()->container()->form()->standard('#', ['radio' => $radio]);
21
22
23 if ($request->getMethod() == "POST") {
24 $form = $form->withRequest($request);
26 } else {
28 }
29
30
31 return
32 "<pre>" . print_r(
$result,
true) .
"</pre><br/>" .
33 $renderer->render($form);
34}