aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/classes/StudipController.php4
-rw-r--r--lib/classes/VueApp.php9
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/classes/StudipController.php b/lib/classes/StudipController.php
index b7c55fd..ec32f27 100644
--- a/lib/classes/StudipController.php
+++ b/lib/classes/StudipController.php
@@ -593,7 +593,11 @@ abstract class StudipController extends Trails\Controller
*/
public function render_vue_app(\Studip\VueApp $app): void
{
+ \NotificationCenter::postNotification('VueAppWillRender', $app);
+
$this->render_template($app->getTemplate(), $this->layout);
+
+ \NotificationCenter::postNotification('VueAppDidRender', $app);
}
diff --git a/lib/classes/VueApp.php b/lib/classes/VueApp.php
index c26b011..910f503 100644
--- a/lib/classes/VueApp.php
+++ b/lib/classes/VueApp.php
@@ -83,6 +83,15 @@ final class VueApp implements Stringable
}
/**
+ * Set the content of a slot.
+ */
+ public function setSlot(string $name, string|Template $content): VueApp
+ {
+ $this->slots[$name] = $content instanceof Template ? $content->render() : $content;
+ return $this;
+ }
+
+ /**
* Add a slot with the given name
*
* If you pass a flexi template as the content, it will be rendered.