ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
disabled.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
37 function disabled()
38 {
39  //Step 0: Declare dependencies
40  global $DIC;
41  $ui = $DIC->ui()->factory();
42  $renderer = $DIC->ui()->renderer();
43  $request = $DIC->http()->request();
44 
45 
46  //Step 1: define the radio
47  $radio = $ui->input()->field()->radio("Radio", "Cannot check an option")
48  ->withOption('value1', 'label1')
49  ->withOption('value2', 'label2')
50  ->withOption('value3', 'label3')
51  ->withDisabled(true);
52 
53 
54  //Step 2: define form and form actions
55  $form = $ui->input()->container()->form()->standard('#', ['radio' => $radio]);
56 
57  //Step 3: implement some form data processing. Note, the value of the checkbox will
58  // be 'checked' if checked and null if unchecked.
59  if ($request->getMethod() == "POST") {
60  $form = $form->withRequest($request);
61  $result = $form->getData();
62  } else {
63  $result = "No result yet.";
64  }
65 
66  //Step 4: Render the radio with the enclosing form.
67  return
68  "<pre>" . print_r($result, true) . "</pre><br/>" .
69  $renderer->render($form);
70 }
$renderer
disabled()
description: > Example showing how to plug a disabled radio into a form
Definition: disabled.php:37
global $DIC
Definition: shib_login.php:22