ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
base.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
8 
18 function base()
19 {
20  global $DIC;
21 
22  // retrieve dependencies
23  $md_renderer = new ilUIMarkdownPreviewGUI();
24  $query_wrapper = $DIC->http()->wrapper()->query();
25  $inputs = $DIC->ui()->factory()->input();
26  $renderer = $DIC->ui()->renderer();
27  $request = $DIC->http()->request();
28 
29  // declare form and input
30  $markdown_input = $inputs->field()->markdown($md_renderer, 'Markdown Input', 'Just a markdown input.');
31  $form = $inputs->container()->form()->standard('#', [$markdown_input]);
32 
33  // please use ilCtrl to generate an appropriate link target
34  // and check it's command instead of this.
35  if ('POST' === $request->getMethod()) {
36  $form = $form->withRequest($request);
37  $data = $form->getData();
38  } else {
39  $data = 'no results yet.';
40  }
41 
42  return
43  '<pre>' . print_r($data, true) . '</pre>' .
44  $renderer->render($form);
45 }
$renderer
base()
description: > The example shows how to create and render a basic markdown field and attach it to a ...
Definition: base.php:18
global $DIC
Definition: shib_login.php:25