81 : StandardForm {
82 $logout_group = $this->ui_factory->input()->field()
83 ->group(
84 [],
85 $this->
lng->txt(
'destination_logout_screen')
86 );
87
88 $login_group = $this->ui_factory->input()->field()
89 ->group(
90 [],
91 $this->
lng->txt(
'destination_login_screen'),
92 $this->lng->txt('destination_login_screen_info')
93 );
94
95 $ref_id = $this->ui_factory->input()->field()
96 ->numeric($this->
lng->txt(
'destination_internal_ressource_ref_id'))
97 ->withAdditionalTransformation(
98 $this->
refinery->custom()->constraint(
99 fn($value) => $this->configurable_logout_target->isInRepository($value),
100 fn(callable $txt, $value) => $txt('logout_behaviour_invalid_ref_id', $value)
101 )
102 )
103 ->withAdditionalTransformation(
104 $this->
refinery->custom()->constraint(
105 fn($value) => $this->configurable_logout_target->isAnonymousAccessible(
106 $value
107 ),
108 fn(callable $txt, $value) => $txt(
109 'logout_behaviour_ref_id_no_access',
110 $value
111 )
112 )
113 )
114 ->withValue($this->
settings->get(
'logout_behaviour_ref_id',
''));
115 if (isset($errors['ref_id'])) {
117 }
118
119 $internal_group = $this->ui_factory->input()->field()
120 ->group(
122 $this->
lng->txt(
'destination_internal_ressource')
123 );
124
125 $url = $this->
settings->get(
'logout_behaviour_url',
'');
126 $html = $this->ui_factory->input()->field()
127 ->url($this->
lng->txt(
'destination_external_ressource_url'))
128 ->withAdditionalTransformation(
129 $this->
refinery->custom()->constraint(
130 fn($value) => $this->configurable_logout_target->isValidExternalResource(
131 (string) $value
132 ),
133 fn(callable $txt, $value) => $txt('logout_behaviour_invalid_url', $value)
134 )
135 )
137 if (isset($errors['url'])) {
138 $html = $html->withError($errors['url']);
139 }
140
141 $external_group = $this->ui_factory->input()->field()
142 ->group(
143 ['url' => $html],
144 $this->
lng->txt(
'destination_external_ressource')
145 );
146
147 $logout_behaviour_switchable_group = $this->ui_factory->input()->field()
148 ->switchableGroup(
149 [
150 LogoutDestinations::LOGOUT_SCREEN->value => $logout_group,
151 LogoutDestinations::LOGIN_SCREEN->value => $login_group,
152 ConfigurableLogoutTarget::INTERNAL_RESSOURCE => $internal_group,
153 ConfigurableLogoutTarget::EXTERNAL_RESSOURCE => $external_group
154 ],
155 $this->
lng->txt(
'destination_after_logout')
156 )
157 ->withValue(
159 'logout_behaviour',
160 LogoutDestinations::LOGOUT_SCREEN->value
161 )
162 );
163
164 $access = $this->rbac_system->checkAccess('write', $this->ref_id);
165 if (!$access) {
166 $logout_behaviour_switchable_group = $logout_behaviour_switchable_group->withDisabled(true);
167 }
168
169 $section = $this->ui_factory->input()->field()
170 ->section(
171 ['logout_behaviour_settings' => $logout_behaviour_switchable_group],
172 $this->
lng->txt(
'logout_behaviour_settings')
173 );
174
175 $form = $this->ui_factory->input()->container()->form()
176 ->standard(
177 $access ?
178 $this->
ctrl->getFormAction($this,
'saveForm') :
179 $this->ctrl->getFormAction($this, 'showForm'),
180 ['logout_behaviour' => $section]
181 );
182 if ($request) {
183 $form = $form->withRequest($request);
184 }
185
186 if (!$access) {
187 $form = $form->withSubmitLabel($this->
lng->txt(
'refresh'));
188 }
189
190 return $form;
191 }