ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
disabled.php File Reference

Go to the source code of this file.

Functions

 disabled ()
 Example showing how to plug a disabled checkbox into a form. More...
 

Function Documentation

◆ disabled()

disabled ( )

Example showing how to plug a disabled checkbox into a form.

Definition at line 5 of file disabled.php.

References $DIC, and $result.

Referenced by ilTestQuestionSideListGUI\__construct(), ilAdvancedMDValues\isDisabled(), ilAdvancedMDValues\read(), ilExplorerSelectInputGUI\render(), ilRadioOption\setDisabled(), ilTestQuestionSideListGUI\setDisabled(), ilADTFormBridge\setDisabled(), ilFormPropertyGUI\setDisabled(), ilButtonBase\setDisabled(), StandardFilterTest\test_render_deactivated_collapsed(), StandardFilterTest\test_render_deactivated_expanded(), PanelSecondaryListingTest\test_render_with_pagination(), PanelSecondaryLegacyTest\test_render_with_pagination(), PanelTest\test_render_with_pagination(), PaginationTest\testRenderDropdown(), PaginationTest\testRenderLimited(), PaginationTest\testRenderLimitedWithCurrentPage(), PaginationTest\testRenderLimitedWithCurrentPage2(), PaginationTest\testRenderUnlimited(), and PaginationTest\testRenderWithCurrentPage().

6 {
7  //Step 0: Declare dependencies
8  global $DIC;
9  $ui = $DIC->ui()->factory();
10  $renderer = $DIC->ui()->renderer();
11  $request = $DIC->http()->request();
12 
13  //Step 1: define the checkbox, and making it disabled
14  $checkbox_input = $ui->input()->field()->checkbox("Checkbox", "Cannot check.")
15  ->withDisabled(true);
16 
17  //Step 2: define form and form actions
18  $form = $ui->input()->container()->form()->standard('#', [ $checkbox_input]);
19 
20  //Step 3: implement some form data processing. Note, the value of the checkbox will
21  // be 'checked' if checked and null if unchecked.
22  if ($request->getMethod() == "POST") {
23  $form = $form->withRequest($request);
24  $result = $form->getData();
25  } else {
26  $result = "No result yet.";
27  }
28 
29  //Step 4: Render the checkbox with the enclosing form.
30  return
31  "<pre>" . print_r($result, true) . "</pre><br/>" .
32  $renderer->render($form);
33 }
$result
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function: