ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
with_limits.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
8 
12 function with_limits()
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  $markdown_input = $markdown_input->withMinLimit(1)->withMaxLimit(20);
26  $form = $inputs->container()->form()->standard('#', [$markdown_input]);
27 
28  // please use ilCtrl to generate an appropriate link target
29  // and check it's command instead of this.
30  if ('POST' === $request->getMethod()) {
31  $form = $form->withRequest($request);
32  $data = $form->getData();
33  } else {
34  $data = 'no results yet.';
35  }
36 
37  return
38  '<pre>' . print_r($data, true) . '</pre>' .
39  $renderer->render($form);
40 }
global $DIC
Definition: feed.php:28
with_limits()
Example show how to create and render a basic markdown field and attach it to a form.
Definition: with_limits.php:12