ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
disabled.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
32function disabled()
33{
34 //Step 0: Declare dependencies
35 global $DIC;
36
37 $ui = $DIC->ui()->factory();
38 $renderer = $DIC->ui()->renderer();
39 $request = $DIC->http()->request();
40 $ctrl = $DIC->ctrl();
41
42 //Define the options.
43 $options = array(
44 "1" => "Type 1",
45 "2" => "Type 2",
46 "3" => "Type 3",
47 "4" => "Type 4",
48 );
49
50 //Step 1: define the select
51 $select = $ui->input()->field()->select("Cannot choose an Option", $options, "This is the byline text")
52 ->withDisabled(true);
53
54 //Step 2: define form and form actions
55 $form = $ui->input()->container()->form()->standard('#', [$select]);
56
57 //Step 3: implement some form data processing.
58 if ($request->getMethod() == "POST") {
59 $form = $form->withRequest($request);
60 $result = $form->getData();
61 } else {
62 $result = "No result yet.";
63 }
64
65 //Step 4: Render the select with the enclosing form.
66 return
67 "<pre>" . print_r($result, true) . "</pre><br/>" .
68 $renderer->render($form);
69}
$renderer
global $DIC
Definition: shib_login.php:26