ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
LangFactory.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
30
32{
34
35 public function __construct(
36 UIFactory $ui_factory,
38 ConstraintDictionary $constraint_dictionary,
40 ) {
42 $this->data_helper = $data_helper;
43 }
44
45 protected function rawInput(
46 ElementInterface $element,
47 ElementInterface $context_element,
48 SlotIdentifier $conditional_slot = SlotIdentifier::NULL
49 ): FormInput {
50 $langs = [];
51 foreach ($this->data_helper->getAllLanguages() as $key) {
52 $langs[$key] = $this->presenter->data()->language($key);
53 }
54 $input = $this->ui_factory->select(
55 $this->getInputLabelFromElement($this->presenter, $element, $context_element),
56 $langs
57 );
58
59 return $this->addConstraintsFromElement(
60 $this->constraint_dictionary,
61 $element,
62 $this->addValueFromElement($element, $input)
63 );
64 }
65
66 public function getInput(
67 ElementInterface $element,
68 ElementInterface $context_element
69 ): FormInput {
70 return $this->rawInput($element, $context_element);
71 }
72
73 public function getInputInCondition(
74 ElementInterface $element,
75 ElementInterface $context_element,
76 SlotIdentifier $conditional_slot
77 ): FormInput {
78 return $this->rawInput($element, $context_element);
79 }
80}
getInput(ElementInterface $element, ElementInterface $context_element)
Definition: LangFactory.php:66
getInputInCondition(ElementInterface $element, ElementInterface $context_element, SlotIdentifier $conditional_slot)
Definition: LangFactory.php:73
rawInput(ElementInterface $element, ElementInterface $context_element, SlotIdentifier $conditional_slot=SlotIdentifier::NULL)
Definition: LangFactory.php:45
__construct(UIFactory $ui_factory, PresenterInterface $presenter, ConstraintDictionary $constraint_dictionary, DataHelperInterface $data_helper)
Definition: LangFactory.php:35
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This describes inputs that can be used in forms.
Definition: FormInput.php:33
This is what a factory for input fields looks like.
Definition: Factory.php:31
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc