ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
with_limits.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
30
41function with_limits()
42{
43 global $DIC;
44
45 // retrieve dependencies
46 $md_renderer = new ilUIMarkdownPreviewGUI();
47 $query_wrapper = $DIC->http()->wrapper()->query();
48 $inputs = $DIC->ui()->factory()->input();
49 $renderer = $DIC->ui()->renderer();
50 $request = $DIC->http()->request();
51
52 // declare form and input
53 $markdown_input = $inputs->field()->markdown($md_renderer, 'Markdown Input', 'Just a markdown input.');
54 $markdown_input = $markdown_input->withMinLimit(1)->withMaxLimit(20);
55 $form = $inputs->container()->form()->standard('#', [$markdown_input]);
56
57 // please use ilCtrl to generate an appropriate link target
58 // and check it's command instead of this.
59 if ('POST' === $request->getMethod()) {
60 $form = $form->withRequest($request);
61 $data = $form->getData();
62 } else {
63 $data = 'no results yet.';
64 }
65
66 return
67 '<pre>' . print_r($data, true) . '</pre>' .
68 $renderer->render($form);
69}
$renderer
global $DIC
Definition: shib_login.php:26