ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
base.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
24 
34 function base()
35 {
36  global $DIC;
37 
38  // retrieve dependencies
39  $md_renderer = new ilUIMarkdownPreviewGUI();
40  $query_wrapper = $DIC->http()->wrapper()->query();
41  $inputs = $DIC->ui()->factory()->input();
42  $renderer = $DIC->ui()->renderer();
43  $request = $DIC->http()->request();
44 
45  // declare form and input
46  $markdown_input = $inputs->field()->markdown($md_renderer, 'Markdown Input', 'Just a markdown input.');
47  $form = $inputs->container()->form()->standard('#', [$markdown_input]);
48 
49  // please use ilCtrl to generate an appropriate link target
50  // and check it's command instead of this.
51  if ('POST' === $request->getMethod()) {
52  $form = $form->withRequest($request);
53  $data = $form->getData();
54  } else {
55  $data = 'no results yet.';
56  }
57 
58  return
59  '<pre>' . print_r($data, true) . '</pre>' .
60  $renderer->render($form);
61 }
$renderer
base()
description: > The example shows how to create and render a basic markdown field and attach it to a ...
Definition: base.php:34
global $DIC
Definition: shib_login.php:22