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