From 8540bb54a41aa616b0264372c67347d26bd1dca1 Mon Sep 17 00:00:00 2001 From: Matheus Zych Date: Tue, 28 Oct 2025 15:25:31 +0100 Subject: [PATCH] Slightly adjusts launcher rendering --- .../Implementation/Component/Launcher/Inline.php | 14 +++++++++----- .../Implementation/Component/Launcher/Renderer.php | 4 ++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/components/ILIAS/UI/src/Implementation/Component/Launcher/Inline.php b/components/ILIAS/UI/src/Implementation/Component/Launcher/Inline.php index 2a4544af5564..6624b7cccc7c 100755 --- a/components/ILIAS/UI/src/Implementation/Component/Launcher/Inline.php +++ b/components/ILIAS/UI/src/Implementation/Component/Launcher/Inline.php @@ -135,17 +135,21 @@ public function withRequest(ServerRequestInterface $request): self { $clone = clone $this; $clone->request = $request; + + if ($request->getMethod() === 'POST') { + $clone->modal = $clone->modal->withRequest($request); + } + return $clone; } public function getResult(): ?Result { - if ($this->request && $this->request->getMethod() == "POST") { - $modal = $this->modal->withRequest($this->request); - $result = $modal->getForm()->getInputGroup()->getContent(); - return $result; + try { + return $this->modal?->getForm()?->getInputGroup()?->getContent(); + } catch (\Throwable) { + return null; } - return null; } public function getModal(): ?Modal\Roundtrip diff --git a/components/ILIAS/UI/src/Implementation/Component/Launcher/Renderer.php b/components/ILIAS/UI/src/Implementation/Component/Launcher/Renderer.php index f1e12683d72c..63bbd1accaa3 100755 --- a/components/ILIAS/UI/src/Implementation/Component/Launcher/Renderer.php +++ b/components/ILIAS/UI/src/Implementation/Component/Launcher/Renderer.php @@ -52,6 +52,10 @@ public function renderInline(Inline $component, RendererInterface $default_rende $start_button = $ui_factory->button()->bulky($launch_glyph, $label, (string) $target); if ($modal = $component->getModal()) { + if ($result?->isError()) { + $modal = $modal->withOnLoad($modal->getShowSignal()); + } + if ($modal_submit_lable = $component->getModalSubmitLabel()) { $modal = $modal->withSubmitLabel($modal_submit_lable); }