iliain/silverstripe-visualfields

Provides a number of CMS fields that display images

Installs: 404

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

Type:silverstripe-vendormodule

2.1.0 2025-05-09 05:22 UTC

This package is auto-updated.

Last update: 2025-05-09 05:26:20 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' => $iconFolderPath . '/icon-1.png',
    'icon-2' => $iconFolderPath . '/icon-2.png',
    'icon-3' => $iconFolderPath . '/icon-3.png',
    'icon-4' => $iconFolderPath . '/icon-4.png',
]));

Customising

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

$typeField
    ->optionWidth('125px')
    ->optionHeight('125px')
    ->backgroundColour('#efe6da') // Only visible if the image has transparency
    ->imageSize('cover');