ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
disabled.php
Go to the documentation of this file.
1 <?php
6 function disabled()
7 {
8  //Step 0: Declare dependencies
9  global $DIC;
10  $ui = $DIC->ui()->factory();
11  $renderer = $DIC->ui()->renderer();
12  $ctrl = $DIC->ctrl();
13  $request = $DIC->http()->request();
14 
15  //Step 1: Define the textarea input field
16  $textarea_input = $ui->input()->field()->textarea("Disabled Textarea Input", "Just a disabled textarea input.")
17  ->withDisabled(true);
18 
19  //Step 2: Define the form action to target the input processing
20  $DIC->ctrl()->setParameterByClass(
21  'ilsystemstyledocumentationgui',
22  'example_name',
23  'disabled'
24  );
25  $form_action = $DIC->ctrl()->getFormActionByClass('ilsystemstyledocumentationgui');
26 
27  //Step 3: Define the form and form actions.
28  $form = $ui->input()->container()->form()->standard($form_action, [$textarea_input]);
29 
30  //Step 4: implement some form data processing.
31  if ($request->getMethod() == "POST" && $request->getQueryParams()['example_name'] == 'disabled') {
32  $form = $form->withRequest($request);
33  $result = $form->getData();
34  } else {
35  $result = "No result yet.";
36  }
37 
38  //Step 5: Render the form with the text input field
39  return
40  "<pre>" . print_r($result, true) . "</pre><br/>" .
41  $renderer->render($form);
42 }
$result
disabled()
Example showing how to plug a disabled checkbox into a form.
Definition: disabled.php:5
$DIC
Definition: xapitoken.php:46