Skip to content

Commit 61855f6

Browse files
committed
Get rid of \Illuminate\Support dependency
1 parent 91fceb5 commit 61855f6

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/HtmlCode.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace InteractionDesignFoundation\NovaHtmlCodeField;
44

5-
use Illuminate\Support\Str;
65
use Laravel\Nova\Fields\Field;
76

87
class HtmlCode extends Field
@@ -26,16 +25,18 @@ class HtmlCode extends Field
2625
public $stacked = true;
2726

2827
/**
29-
* @param string|\Closure $template
30-
* @return $this
28+
* Set default HTML code (template).
29+
* In order to instruct package where to inject generated HTML, please provide a special marker: "%CODE%"
30+
* Example: <section>%CODE%<section>
31+
* @param string|\Closure():string $template
3132
*/
3233
public function previewTemplate($template): self
3334
{
3435
if (is_callable($template)) {
3536
$template = $template();
3637
}
3738

38-
if (!Str::contains($template, '%CODE%')) {
39+
if (strpos($template, '%CODE%') === false) {
3940
throw new \InvalidArgumentException('%CODE% placeholder is not found in your template. Please add it.');
4041
}
4142

@@ -44,8 +45,11 @@ public function previewTemplate($template): self
4445
]);
4546
}
4647

47-
/**Inject styles to template */
48-
public function styles(array $stylesUrls): self
48+
/**
49+
* Inject styles to template
50+
* @param list<string> $stylesUrls
51+
*/
52+
final public function styles(array $stylesUrls): self
4953
{
5054
return $this->withMeta([
5155
'styles' => $stylesUrls,

0 commit comments

Comments
 (0)