ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
8use ILIAS\Data\Factory as DataFactory;
10
14class Text extends Input implements C\Input\Field\Text
15{
19 public function __construct(
20 DataFactory $data_factory,
21 \ILIAS\Refinery\Factory $refinery,
22 $label,
23 $byline
24 ) {
25 parent::__construct($data_factory, $refinery, $label, $byline);
26 $this->setAdditionalTransformation($refinery->custom()->transformation(function ($v) {
27 return strip_tags($v);
28 }));
29 }
30
34 protected function isClientSideValueOk($value) : bool
35 {
36 return is_string($value);
37 }
38
39
43 protected function getConstraintForRequirement()
44 {
45 return $this->refinery->string()->hasMinLength(1);
46 }
47
51 public function getUpdateOnLoadCode() : \Closure
52 {
53 return function ($id) {
54 $code = "$('#$id').on('input', function(event) {
55 il.UI.input.onFieldUpdate(event, '$id', $('#$id').val());
56 });
57 il.UI.input.onFieldUpdate(event, '$id', $('#$id').val());";
58 return $code;
59 };
60 }
61}
An exception for terminatinating execution or to throw for unit testing.
Builds data types.
Definition: Factory.php:20
__construct(DataFactory $data_factory, \ILIAS\Refinery\Factory $refinery, $label, $byline)
Definition: Text.php:19
getUpdateOnLoadCode()
Get update code.This method has to return JS code that calls il.UI.filter.onFieldUpdate(event,...
Definition: Text.php:51
This describes commonalities between all inputs.
Definition: Input.php:32
This describes text inputs.
Definition: Text.php:11
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Class ChatMainBarProvider \MainMenu\Provider.