3use ILIAS\GlobalScreen\Scope\MainMenu\Collector\Renderer\Hasher;
67 $this->item_facade = $item;
69 if (!$this->item_facade->isEmpty()) {
79 $txt =
function ($id) :
string {
80 return $this->lng->txt($id);
82 $f =
function () : InputFactory {
83 return $this->ui_fa->input();
86 $title =
$f()->field()->text(
$txt(
'sub_title_default'),
$txt(
'sub_title_default_byline'));
87 if (!$this->item_facade->isEmpty()) {
88 $title = $title->withValue($this->item_facade->getDefaultTitle());
93 if (($this->item_facade->isEmpty() || $this->item_facade->isCustom())) {
95 $type =
$f()->field()->switchableGroup($type_groups,
$txt(
'sub_type'),
$txt(
'sub_type_byline'))->withRequired(
true);
96 if (!$this->item_facade->isEmpty()) {
97 $string = $this->item_facade->getType() ===
'' ? Link::class : $this->item_facade->getType();
98 $type =
$type->withValue($this->hash($string));
100 $type =
$type->withValue($this->hash(Link::class));
106 if ($this->item_facade->supportsCustomIcon()) {
109 ->withByline(
$txt(
'sub_icon_byline'))
111 if ($this->item_facade->getIconID() !==
null) {
112 $icon = $icon->withValue([$this->item_facade->getIconID()]);
119 $parent =
$f()->field()->select(
$txt(
'sub_parent'), $this->
repository->getPossibleParentsForFormAndTable())
120 ->withRequired(
true);
121 if (!$this->item_facade->isEmpty() && !$this->item_facade->isInLostItem()) {
122 $parent = $parent->withValue($this->item_facade->getParentIdentificationString());
124 $array = array_keys($this->
repository->getPossibleParentsForFormAndTable());
125 $parent = $parent->withValue(reset($array));
130 $active =
$f()->field()->checkbox(
$txt(
'sub_active'),
$txt(
'sub_active_byline'));
131 $active = $active->withValue($this->item_facade->isActivated());
135 if ($this->item_facade->isEmpty()) {
137 $this->form =
$f()->container()->form()
141 $this->form =
$f()->container()->form()
150 $this->form = $this->form->withRequest(
$DIC->http()->request());
151 $data = $this->form->getData();
153 if (is_null(
$data)) {
157 $this->item_facade->setAction((
string)
$data[0][
'action']);
158 $this->item_facade->setDefaultTitle((
string)
$data[0][self::F_TITLE]);
159 $this->item_facade->setActiveStatus((
bool)
$data[0][self::F_ACTIVE]);
160 if ((
string)
$data[0][self::F_PARENT]) {
161 $this->item_facade->setParent((
string)
$data[0][self::F_PARENT]);
163 $this->item_facade->setIsTopItm(
false);
165 if ($this->item_facade->isEmpty()) {
166 $type = $this->unhash((
string) (
$data[0][self::F_TYPE][0]));
167 $this->item_facade->setType(
$type);
168 $r->createItem($this->item_facade);
171 if ($this->item_facade->supportsCustomIcon()) {
172 $icon = (string)
$data[0][self::F_ICON][0];
173 $this->item_facade->setIconID($icon);
176 if ($this->item_facade->isCustom()) {
177 $type = $this->item_facade->getType();
178 $type_specific_data = (array)
$data[0][self::F_TYPE][1];
180 $type_handler->saveFormFields($this->item_facade->identification(), $type_specific_data);
183 $r->updateItem($this->item_facade);
190 return $this->ui_re->render([$this->form]);
200 $type_informations = $this->
repository->getPossibleSubItemTypesWithInformation();
201 foreach ($type_informations as $classname => $information) {
202 if ($this->item_facade->isEmpty()
203 || (!$this->item_facade->isEmpty() && $classname === $this->item_facade->getType() && $this->item_facade->isCustom())
205 $inputs = $this->
repository->getTypeHandlerForType($classname)->getAdditionalFieldsForSubForm($this->item_facade->identification());
206 $type_groups[$this->hash($classname)] =
$f()->field()->group($inputs, $information->getTypeNameForPresentation());
An exception for terminatinating execution or to throw for unit testing.
Class Link Attention: This is not the same as the \ILIAS\UI\Component\Link\Link.
This class provides processing control methods.
Class ilMMItemRepository.
Class ilMMUploadHandlerGUI.
This is how the factory for UI elements looks.
An entity that renders components to a string output.
Interface ilMMItemFacadeInterface.