ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
NonNegIntFactory.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
29 
31 {
32  protected Refinery $refinery;
33 
34  public function __construct(
38  Refinery $refinery
39  ) {
40  parent::__construct($ui_factory, $presenter, $constraint_dictionary);
41  $this->refinery = $refinery;
42  }
43 
44  protected function rawInput(
45  ElementInterface $element,
46  ElementInterface $context_element,
47  string $condition_value = ''
48  ): FormInput {
49  return $this->ui_factory
50  ->numeric('placeholder')
52  $this->refinery->int()->isGreaterThanOrEqual(0)
53  )
55  $this->refinery->byTrying([
56  $this->refinery->kindlyTo()->string(),
57  $this->refinery->kindlyTo()->null()
58  ])
59  );
60  }
61 }
This is what a factory for input fields looks like.
Definition: Factory.php:28
__construct(UIFactory $ui_factory, PresenterInterface $presenter, ConstraintDictionary $constraint_dictionary, Refinery $refinery)
withAdditionalTransformation(Transformation $trafo)
Apply a transformation to the content of the input.
__construct(VocabulariesInterface $vocabularies)
rawInput(ElementInterface $element, ElementInterface $context_element, string $condition_value='')
This describes inputs that can be used in forms.
Definition: FormInput.php:31