Skip to content

Commit 7a53dc5

Browse files
committed
feat: support inline blade component views
1 parent 4d051a8 commit 7a53dc5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Html/Layout.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,20 @@ public function bottomEndView(string $selector, ?int $order = null): static
9393
}
9494

9595
/**
96-
* @param Renderable|view-string $view
97-
*
9896
* @throws Throwable
9997
*/
10098
public function addView(
10199
Renderable|string $view,
102100
LayoutPosition $layoutPosition,
103101
?int $order = null
104102
): static {
105-
$html = $view instanceof Renderable ? $view->render() : view($view)->render();
103+
if ($view instanceof Renderable) {
104+
$html = $view->render();
105+
} else {
106+
// Support for inline component views
107+
$html = strip_tags($view) !== $view ? $view : view($view)->render();
108+
}
109+
106110
$element = json_encode($html);
107111

108112
if ($element === false) {

0 commit comments

Comments
 (0)