iliain/silverstripe-visualfields

Provides a number of CMS fields that display images

Installs: 348

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: 2024-12-16 01:45:07 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', $layoutField = VisualOptionField::create('BlockLayout', 'Layout', [
    'layout-1' => $layoutFolderPath . '/layout-1.png',
    'layout-2' => $layoutFolderPath . '/layout-2.png'
]));

Visual Fields

Customising

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

$layoutField->setOptionWidth('250px');
$layoutField->setOptionHeight('150px');
$layoutField->setOptionBackgroundColour('#f0f0f0'); // Only visible if the image has transparency

Visual Fields