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
If you aren't using Alpine Js in your application then you'll need to load [handmadeweb/datafetcher.js](https://github.com/HandmadeWeb/datafetcher.js) in your footer, you can either do this manually, or via the provided helpers for Alpine: `{{ frosty:scripts }}`, Blade: `@frostyScripts` or PHP: `\HandmadeWeb\Frosty\Frosty::scripts();`
27
27
28
-
#### Alpine Js Method
28
+
This method uses the `native.blade.php` view, you are free to override it in `resources/vendor/frosty/`, you will have access to the `content`, `endpoint` and `mode` variables.
29
29
30
-
If you are using Alpine Js in your application then you may update your Frosty configuration to use Alpine.
30
+
#### Alpine.Js Method
31
+
32
+
If you are using Alpine.Js in your application then you may update your Frosty configuration to use Alpine.
* - If you aren't using Alpine Js in your application then you'll need to load handmadeweb/datafetcher.js in your footer.
@@ -44,6 +46,35 @@ If you are using Alpine Js in your application then you may update your Frosty c
44
46
'mode' => 'alpine',
45
47
```
46
48
49
+
This method uses the `alpine.blade.php` view, you are free to override it in `resources/vendor/frosty/`, you will have access to the `content`, `endpoint` and `mode` variables.
50
+
51
+
#### Custom Method
52
+
53
+
You are free to use a custom method, you may do so by defining a new view template for Frosty to use under `resources/vendor/frosty`, the filenames `alpine`, `native` and `not-found` are considered to be reserved, although you may override them if you wish.
54
+
55
+
Once you have created a new view for your mode, you will have access to the `content`, `endpoint` and `mode` variables, you may then use this to provide the content or endpoint to your custom method.
56
+
57
+
Then it is just a matter of updating the mode to use the name of your new method/view.
58
+
59
+
Lets say we created a file called `myCustomVueMode.blade.php` which might contain something like,
In the event that your custom method/mode doesn't have a corresponding view file, then Frosty will insert some HTML comments in the location of where it would have rendered your method.
70
+
71
+
```html
72
+
<!-- Frosty could not be rendered, Mode not found -->
73
+
74
+
<!-- If the page is being viewed by a Super Administrator, then the below will also be inserted as a comment. -->
75
+
<!-- Mode: {{ $mode }} -->
76
+
<!-- Endpoint: {{ $endpoint }} -->
77
+
```
47
78
48
79
## Antlers Usage
49
80
Using Frosty in `Antlers` can be done by using the `frosty` tag or if you are using an `.antlers.php` template file by using the `class` (see class instructions)
@@ -81,6 +112,15 @@ This works with both the route and url options.
81
112
{{ /frosty:fetch }}
82
113
```
83
114
115
+
### Using a different mode/view.
116
+
You are free to use any other mode/view that might be available for Frosty to use, separately to whatever you might have set as the config default.
117
+
You can do this by passing the mode parameter, which will relate to the name of a view file located in `resources/vendor/frosty/`
Using Frosty in `Blade` can be done by using the `frosty` blade directive or by using the `class` (see class instructions)
86
126
The blade directive currently doesn't accept providing content or context, If you need to use that functionality the you'll need to use the class chaining method.
@@ -105,6 +145,13 @@ You can also use named arguments in PHP 8+ to specify particular parameters.
105
145
@frosty(route('ajax.sponsors', 'featured'))
106
146
```
107
147
148
+
### Using a different mode/view.
149
+
You are free to use any other mode/view that might be available for Frosty to use, separately to whatever you might have set as the config default.
150
+
You can do this by passing the mode parameter, which will relate to the name of a view file located in `resources/vendor/frosty/`
0 commit comments