unclecheese/silverstripe-image-optionset
最新稳定版本:2.0
Composer 安装命令:
composer require unclecheese/silverstripe-image-optionset
包简介
Provides a list of selectable items that use images as the primary label instead of text.
README 文档
README
Provides a list of selectable items that use images as the primary label instead of text.
Screenshot
Installation
composer require unclecheese/silverstripe-image-optionset
Configuration
You can configure the default width and height of the images.
UncleCheese\Forms\ImageOptionsetField: default_image_width: 300 default_image_height: 300
Usage
Simple example:
$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.
$field = ImageOptionsetField::create('Template', 'Select a template') ->setSource([ 'sidebar' => '/path/to/sidebar.png' 'block' => '/path/to/block.png' ]);
Tests
tests/ImageOptionsetFieldTest
Troubleshooting
Ring Uncle Cheese.
统计信息
- 总下载量: 8.9k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 13
- 点击次数: 0
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2016-05-10
