87 $txt =
function ($key) {
88 return $this->lng->txt($key);
91 return $this->ui_fa->input();
95 $title =
$f()->field()->text(
$txt(
'topitem_title_default'),
$txt(
'topitem_title_default_byline'))
97 if (!$this->item_facade->isEmpty()) {
98 $title = $title->withValue($this->item_facade->getDefaultTitle());
101 $items[self::F_TITLE] = $title;
103 if ($this->item_facade->supportsCustomIcon()) {
106 ->withByline(
$txt(
'topitem_icon_byline'))
110 if ($this->item_facade->getIconID() !== null) {
111 $icon = $icon->withValue([$this->item_facade->getIconID()]);
114 $items[self::F_ICON] = $icon;
118 if (($this->item_facade->isEmpty() || $this->item_facade->isCustom())) {
119 $type_groups = $this->
getTypeGroups(
$f, $this->item_facade->isEmpty());
120 $type =
$f()->field()->switchableGroup(
122 $txt(
'topitem_type'),
123 $txt(
'topitem_type_byline')
124 )->withRequired(
true);
125 if (!$this->item_facade->isEmpty()) {
126 $string = $this->item_facade->getType() ===
'' ? TopParentItem::class : $this->item_facade->getType();
127 $type = $type->withValue($this->
hash($string));
129 $type = $type->withValue($this->
hash(TopParentItem::class));
131 $items[self::F_TYPE] =
$type;
135 $active =
$f()->field()->checkbox(
$txt(
'topitem_active'),
$txt(
'topitem_active_byline'));
136 $active = $active->withValue($this->item_facade->isActivated());
137 $items[self::F_ACTIVE] = $active;
140 if ($this->item_facade->supportsRoleBasedVisibility()) {
142 $value_role_based_visibility = NULL;
143 $global_roles =
$access->getGlobalRoles();
144 $global_role_ids = $this->item_facade->getGlobalRoleIDs();
145 if($this->item_facade->hasRoleBasedVisibility() && !empty($global_role_ids)) {
147 $value_role_based_visibility[0] = array_intersect(
149 array_keys($global_roles)
152 $role_based_visibility =
$f()->field()->optionalGroup(
154 $f()->field()->multiSelect(
155 $txt(
'sub_global_roles'),
157 )->withRequired(
true)
159 $txt(
'sub_role_based_visibility'),
160 $txt(
'sub_role_based_visibility_byline')
161 )->withValue($value_role_based_visibility);
162 $items[self::F_ROLE_BASED_VISIBILITY] = $role_based_visibility;
166 if ($this->item_facade->isEmpty()) {
168 $this->form =
$f()->container()->form()->standard($this->ctrl->getLinkTargetByClass(ilMMTopItemGUI::class,
172 $this->form =
$f()->container()->form()->standard($this->ctrl->getLinkTargetByClass(ilMMTopItemGUI::class,
Class ilMMUploadHandlerGUI.