iliain/silverstripe-visualfields

Provides a number of CMS fields that display images

Installs: 387

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

Type:silverstripe-vendormodule

2.0.0 2024-10-16 01:11 UTC

This package is auto-updated.

Last update: 2025-02-19 05:24:08 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->setOptionWidth('125px');
$typeField->setOptionHeight('125px');
$typeField->setOptionBackground('#efe6da'); // Only visible if the image has transparency