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

2
2
3
3
# Font Awesome
4
-
This Statamic addon adds a Fieldtype to easily search and select Font Awesome icons. It also comes with a Tag to output selected icons in your template. It supports Font Awesome version `5.x` and `6.x`.
5
-
6
-
## Prerequisites
7
-
To use this addon, you need a Font Awesome account. [Register here](https://fontawesome.com/start) if you don't already have one.
8
-
9
-
### API Token
10
-
You need to get your API Token. You can [generate one here](https://fontawesome.com/account).
11
-
12
-
### Kit Token
13
-
You also need to get the Token of the Kit you want to use. You can [create a Kit here](https://fontawesome.com/kits). The Kit Token is the number of the Kit, e.g. `f481b75381`.
4
+
This Statamic addon features an icon fieldtype to browse and select Font Awesome 6.x icons. It also comes with a Tag to output selected icons in your template.
14
5
15
6
## Installation
16
7
Install the addon using Composer:
@@ -25,64 +16,59 @@ You may publish the config of the package:
| The Token of the Kit you want to use, e.g. b121fed549.
50
-
|
51
-
*/
52
-
53
-
'kit_token' => env('FA_KIT_TOKEN'),
54
-
55
-
];
26
+
'driver' => 'kit'
56
27
```
57
28
58
-
## Configuration
59
-
Add your `API Token` and `Kit Token` to your `.env` file:
29
+
Next, add your `API Token` and `Kit Token` to your `.env` file:
60
30
61
31
```env
62
32
FA_API_TOKEN=************************************
63
33
FA_KIT_TOKEN=************************************
64
34
```
65
35
36
+
### Local Driver
37
+
If you would rather host Font Awesome yourself, you may use the `local` driver:
38
+
39
+
```php
40
+
'driver' => 'local'
41
+
```
42
+
43
+
Next, download [Font Awesome (For The Web)](https://fontawesome.com/download) and place the `metadata` and `css` directories in the locations defined in the config:
The files in the `metadata` directory are required to get the information about the icons. I recommend placing the metadata in the `resources` directory, as these files don't need to be publicly accessible.
54
+
55
+
#### CSS
56
+
The `css` config option defines the public path to the stylesheet that will be loaded in the Control Panel. The stylesheet must be placed in the `public` directory. The CSS will only be loaded in the Control Panel. You still need to add the stylesheet to your frontend layout yourself.
57
+
66
58
## Usage
67
59
68
60
### Fieldtype
69
61
70
-
Add the `Font Awesome` Fieldtype to a Blueprint or Fieldset. The Fieldtype provides the option to only make certain icon styles available for selection.
62
+
Add the `Font Awesome` Fieldtype to a Blueprint or Fieldset. The Fieldtype provides a config option that allows you to make only certain icon styles available for selection.
71
63
72
64
### Tag
73
65
74
-
Add the following Tag to the `<head>` of your layout view to render the Font Awesome script.
66
+
If you're using the `kit` driver, add the following Tag to your layout's `<head>` to render the Font Awesome script.
75
67
76
68
```antlers
77
69
{{ font_awesome:kit }}
78
70
```
79
71
80
-
You may use a different Kit for rendering the icons in your template using the `token` parameter.
81
-
82
-
```antlers
83
-
{{ font_awesome:kit token="f481b75381" }}
84
-
```
85
-
86
72
Render an icon by using the handle of a Font Awesome field as the wildcard method.
87
73
88
74
```antlers
@@ -97,7 +83,5 @@ You may also use the shorter tag alias instead.
97
83
{{ fa:icon_field }}
98
84
```
99
85
100
-
101
-
102
86
## Credits
103
87
Developed by [Michael Aerni](https://www.michaelaerni.ch)
0 commit comments