File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 22
33namespace InteractionDesignFoundation \NovaHtmlCodeField ;
44
5- use Illuminate \Support \Str ;
65use Laravel \Nova \Fields \Field ;
76
87class 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 ,
You can’t perform that action at this time.
0 commit comments