ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
LangFactory.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
31
33{
35
36 public function __construct(
37 UIFactory $ui_factory,
39 ConstraintDictionary $constraint_dictionary,
41 ) {
43 $this->data_helper = $data_helper;
44 }
45
46 protected function rawInput(
47 ElementInterface $element,
48 ElementInterface $context_element,
49 SlotIdentifier $conditional_slot = SlotIdentifier::NULL
50 ): FormInput {
51 $langs = [];
52 foreach ($this->data_helper->getAllLanguages() as $key) {
53 $langs[$key] = $this->presenter->data()->language($key);
54 }
55 $input = $this->ui_factory->select(
56 $this->getInputLabelFromElement($this->presenter, $element, $context_element),
57 $langs
58 );
59
60 return $this->addConstraintsFromElement(
61 $this->constraint_dictionary,
62 $element,
63 $this->addValueFromElement($element, $input)
64 );
65 }
66
67 public function getInput(
68 ElementInterface $element,
69 ElementInterface $context_element
70 ): FormInput {
71 return $this->rawInput($element, $context_element);
72 }
73
74 public function getInputInCondition(
75 ElementInterface $element,
76 ElementInterface $context_element,
77 SlotIdentifier $conditional_slot
78 ): FormInput {
79 return $this->rawInput($element, $context_element);
80 }
81}
rawInput(ElementInterface $element, ElementInterface $context_element, SlotIdentifier $conditional_slot=SlotIdentifier::NULL)
Definition: LangFactory.php:46
getInputInCondition(ElementInterface $element, ElementInterface $context_element, SlotIdentifier $conditional_slot)
Definition: LangFactory.php:74
getInput(ElementInterface $element, ElementInterface $context_element)
Definition: LangFactory.php:67
__construct(UIFactory $ui_factory, PresenterInterface $presenter, ConstraintDictionary $constraint_dictionary, DataHelperInterface $data_helper)
Definition: LangFactory.php:36
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