Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions content/collections/fieldtypes/icon.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,6 +19,12 @@ options:
type: string
description: 'Set the default option key. Default: none.'
required: false
-
id: iA4enf0t
name: mode
type: string
description: 'Choose between `default` (dropdown) and `compact` (icon picker) UI modes. Default: `default`.'
required: false
---
## Overview

Expand DownExpand Up@@ -64,4 +70,16 @@ Icon::register('heroicons', base_path('resources/heroicons')); // [tl! ++]
field:
type: icon
set: heroicons # [tl! ++]
```

## UI Mode

By default, the Icon field displays a searchable dropdown. Setting `mode` to `compact` swaps this out for a single icon-only button that opens a modal picker, saving vertical space in your publish forms.

```yaml
-
handle: favourite_icon
field:
type: icon
mode: compact # [tl! ++]
```
28 changes: 28 additions & 0 deletions content/collections/pages/building-an-addon.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -581,6 +581,34 @@ public function bootAddon()

Your addon's settings page will show up in the Control Panel under **Tools -> Addons**. Pretty convenient.

You can also pass a closure to `registerSettingsBlueprint()`, which will only be evaluated when the blueprint is actually needed. This is handy if building the blueprint is expensive, or requires services that aren't available at boot time.

```php
public function bootAddon()
{
$this->registerSettingsBlueprint(function () {
return [
'tabs' => [
'main' => [
'sections' => [
[
'display' => __('API'),
'fields' => [
[
'handle' => 'api_key',
'field' => ['type' => 'text', 'display' => 'API Key', 'validate' => 'required'],
],
// ...
],
],
],
],
],
];
});
}
```

You can even reference config options (and by extension environment variables) in your settings blueprint using Antlers, like so: `{{ config:app:url }}`.

Settings are stored as YAML files in `resources/addons` by default, but can be moved to the database if you prefer. Just run the `php please install:eloquent-driver` command and you're all set.
Expand Down