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
Requires
- php: ^7 || ^8
- silverstripe/framework: ^4 || ^5
README
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' ]));
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