iliain/silverstripe-visualfields

Provides a number of CMS fields that display images

Maintainers

Package info

github.com/Iliain/silverstripe-visualfields

Homepage

Type:silverstripe-vendormodule

pkg:composer/iliain/silverstripe-visualfields

Transparency log

Statistics

Installs: 820

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

3.1.0 2026-07-07 02:03 UTC

This package is auto-updated.

Last update: 2026-07-07 02:08:34 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

Provides similar functionality to heyday/silverstripe-colorpalette, but uses images rather than colours.

Installation (with composer)

composer require iliain/silverstripe-visualfields

Usage

$fields->addFieldToTab('Root.Main', $typeField = VisualOptionField::create('IconType', 'Type', [
    'icon-1' => '/path/to/icon-1.png',
    'icon-2' => '/path/to/icon-2.png',
    'icon-3' => '/path/to/icon-3.png',
    'icon-4' => '/path/to/icon-4.png',
]));

Customising

You can customise the size and background colour of the images with the following options:

$typeField
    ->setOptionWidth('125px')
    ->setOptionHeight('125px')
    ->setOptionBackground('#efe6da') // Only visible if the image has transparency
    ->setBackgroundSize('cover');


You can also use the setReadonly() method to make the field read-only, which will disable the radio buttons and prevent the user from changing the value, but allow them to see the stylised options.

$typeField->setReadonly(true);