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