dev-master
9999999-devProvides a list of selectable items that use images as the primary label instead of text.
BSD-3-Clause GNU
The Requires
by Uncle Cheese
image silverstripe radio optionsetfield
Wallogit.com
2017 © Pedro Peláez
Provides a list of selectable items that use images as the primary label instead of text.
Provides a list of selectable items that use images as the primary label instead of text., (*1)
, (*2)
composer require unclecheese/silverstripe-image-optionset, (*3)
You can configure the default width and height of the images., (*4)
UncleCheese\Forms\ImageOptionsetField: default_image_width: 300 default_image_height: 300
Simple example:, (*5)
$field = ImageOptionsetField::create('Template', 'Select a template')
->setSource([
'sidebar' => [
'title' => 'Sidebar page',
'image' => '/path/to/sidebar.png'
],
'block' => [
'title' => 'Block page',
'image' => '/path/to/block.png'
]
]);
// Use a custom image width and height
$field->setImageWidth(100);
$field->setImageHeight(100);
If you're not using titles, you can use image paths as the values rather than nested arrays., (*6)
$field = ImageOptionsetField::create('Template', 'Select a template')
->setSource([
'sidebar' => '/path/to/sidebar.png'
'block' => '/path/to/block.png'
]);
tests/ImageOptionsetFieldTest, (*7)
Ring Uncle Cheese., (*8)
Provides a list of selectable items that use images as the primary label instead of text.
BSD-3-Clause GNU
image silverstripe radio optionsetfield