You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guide/form-fields/html.md
+7-15Lines changed: 7 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,13 +6,13 @@ This field is read-only, and is meant to display some dynamic information in the
6
6
7
7
## Configuration
8
8
9
-
### `setInlineTemplate(string $template)`
9
+
### `setTemplate(string|View $template)`
10
10
11
-
Write the template as a string, using placeholders for data (eg: `{{var}}`). Example:
11
+
Write the blade template as a string. Example:
12
12
13
13
```php
14
14
SharpFormHtmlField::make('panel')
15
-
->setInlineTemplate('This product is offline since <strong>{{date}}</strong>')
15
+
->setTemplate('This product is offline since <strong>{{ $date}}</strong>')
16
16
```
17
17
18
18
This example would mean that your transformed data has an object named `panel` containing a `date` attribute. Here a custom transformer example for this particular case:
@@ -28,21 +28,13 @@ function find($id): array
28
28
}
29
29
```
30
30
31
-
### `setTemplatePath(string $templatePath)`
31
+
You can also pass a view (blade) :
32
32
33
-
Use this if you need more control: give the path of a full template, in its own file.
34
-
35
-
The template will be [interpreted by Vue.js](https://vuejs.org/v2/guide/syntax.html), meaning you can add data placeholders, DOM structure but also directives, and anything that Vue will parse. For instance:
36
-
37
-
```vue
38
-
<div v-if="show">result is {{value}}</div>
39
-
<div v-else>result is unknown</div>
33
+
```php
34
+
SharpFormHtmlField::make('panel')
35
+
->setTemplate(view('sharp.form-htm-field'))
40
36
```
41
37
42
-
### `setAdditionalTemplateData(array $data)`
43
-
44
-
Pass data to the template that is not part of the transformed data.
Copy file name to clipboardExpand all lines: docs/guide/upgrading/9.0.md
+10-1Lines changed: 10 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -826,4 +826,13 @@ new class extends Migration
826
826
827
827
### `SharpFormListField` collapsed items template feature was removed
828
828
829
-
`setCollapsedItemInlineTemplate()` & `setCollapsedItemTemplatePath()` methods was removed due to limited usage and general migration into non-Vue templates.
829
+
`setCollapsedItemInlineTemplate()` & `setCollapsedItemTemplatePath()` methods was removed due to limited usage and general migration into blade templates.
830
+
831
+
### `SharpFormHtmlField` has migrated to blade templates
832
+
833
+
`setInlineTemplate()` & `setTemplatePath()` must be converted to :
834
+
-`setTemplate('blade template string')` or
835
+
-`setTemplate(view('sharp.form-field'))`.
836
+
837
+
See [field page](../form-fields/html) for more information.
0 commit comments