xddesigners/iconselectfield

Adds a configurable icon select field

Maintainers

👁 TheBnl

Package info

github.com/xddesigners/iconselectfield

Type:silverstripe-vendormodule

pkg:composer/xddesigners/iconselectfield

Statistics

Installs: 262

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

6.0.0 2025-09-12 14:15 UTC

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

BSD-3-Clause e848a04c30ce0f0495bc144d0e42c1971265f3d1

  • Remy Vaartjes <remy.woop@xd.nl>

silverstripefieldsvgFontAwesomeicon

This package is auto-updated.

Last update: 2026-06-30 11:56:48 UTC


README

Add a icon select field to the Silverstripe CMS.

Installation

composer require xddesigners/iconselectfield

Usage

Add a icon field to your db. This field will automaticly scaffold a IconSelectField.

class YourClass extends DataObject
{
 private static $db = [
 'Icon' => 'Icon'
 ];

 public function getCMSFields()
 {
 $fields = parent::getCMSFields();
 $fields->addFieldsToTab('Root.Main', [
 // this field is automaticly scaffolded
 IconSelectField::create('Icon', 'Icon')
 ]);

 $fields;
 }
}

In your template you can now access the Icon property and this will be replaced by the selected icon.

$Icon

You can confugure the icons you want to use trough a yml config.

---
Name: vivabasicIcons
---
XD\IconSelectField\Forms\IconSelectField:
 fonts_include:
 # add your own link to a font awesome version your using
 - '<link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.12.1/css/all.css" crossorigin="anonymous">'
 icons:
 system:
 arrow-right: 'fas fa-arrow-right'
 arrow-left: 'fas fa-arrow-left'
 custom-icon: '<svg />' # you can also configure custom svg icons