Skip to content

Commit f67c9a8

Browse files
committed
Move convesion from string to Text into Callout::assemble
1 parent e07f395 commit f67c9a8

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

src/Widget/Callout.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ class Callout extends BaseHtmlElement
2424

2525
protected $defaultAttributes = ['class' => 'callout'];
2626

27-
/**
28-
* @var ValidHtml The content of the callout
29-
*/
30-
protected ValidHtml $content;
31-
3227
/**
3328
* Create a new callout
3429
*
@@ -38,13 +33,9 @@ class Callout extends BaseHtmlElement
3833
*/
3934
public function __construct(
4035
protected CalloutType $type,
41-
ValidHtml|string $content,
36+
protected ValidHtml|string $content,
4237
protected ?string $title = null
4338
) {
44-
if (is_string($content)) {
45-
$content = new Text($content);
46-
}
47-
$this->content = $content;
4839
$this->addAttributes(Attributes::create(['class' => $type->value]));
4940
}
5041

@@ -59,7 +50,7 @@ public function assemble(): void
5950
$this->title
6051
? HtmlElement::create('strong', ['class' => 'callout-title'], new Text($this->title))
6152
: null,
62-
$this->content,
53+
is_string($this->content) ? new Text($this->content) : $this->content,
6354
],
6455
));
6556
}

0 commit comments

Comments
 (0)