ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
Text.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 2017 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4 
6 
7 use ILIAS\UI\Component as C;
10 
14 class Text extends Input implements C\Input\Field\Text
15 {
19  private $complex = false;
20 
24  public function __construct(
25  DataFactory $data_factory,
26  \ILIAS\Refinery\Factory $refinery,
27  $label,
28  $byline
29  ) {
30  parent::__construct($data_factory, $refinery, $label, $byline);
31  $this->setAdditionalTransformation($refinery->custom()->transformation(function ($v) {
32  return strip_tags($v);
33  }));
34  }
35 
39  protected function isClientSideValueOk($value) : bool
40  {
41  return is_string($value);
42  }
43 
44 
48  protected function getConstraintForRequirement()
49  {
50  return $this->refinery->string()->hasMinLength(1);
51  }
52 
56  public function getUpdateOnLoadCode() : \Closure
57  {
58  return function ($id) {
59  $code = "$('#$id').on('input', function(event) {
60  il.UI.input.onFieldUpdate(event, '$id', $('#$id').val());
61  });
62  il.UI.input.onFieldUpdate(event, '$id', $('#$id').val());";
63  return $code;
64  };
65  }
66 
70  public function isComplex() : bool
71  {
72  return $this->complex;
73  }
74 }
Class ChatMainBarProvider .
__construct(DataFactory $data_factory, \ILIAS\Refinery\Factory $refinery, $label, $byline)
Definition: Text.php:24
Builds data types.
Definition: Factory.php:19
This describes text inputs.
Definition: Text.php:10
__construct(Container $dic, ilPlugin $plugin)