2017 © Pedro Peláez
 

silverstripe-vendormodule silverstripe-image-optionset

Provides a list of selectable items that use images as the primary label instead of text.

image

unclecheese/silverstripe-image-optionset

Provides a list of selectable items that use images as the primary label instead of text.

  • Friday, February 9, 2018
  • by unclecheese
  • Repository
  • 1 Watchers
  • 12 Stars
  • 1,076 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 4 Forks
  • 2 Open issues
  • 1 Versions
  • 71 % Grown

The README.md

Image OptionsetField

Provides a list of selectable items that use images as the primary label instead of text., (*1)

Screenshot

, (*2)

Installation

composer require unclecheese/silverstripe-image-optionset, (*3)

Configuration

You can configure the default width and height of the images., (*4)

UncleCheese\Forms\ImageOptionsetField:
  default_image_width: 300
  default_image_height: 300

Usage

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

tests/ImageOptionsetFieldTest, (*7)

Troubleshooting

Ring Uncle Cheese., (*8)

The Versions

09/02 2018

dev-master

9999999-dev

Provides a list of selectable items that use images as the primary label instead of text.

  Sources   Download

BSD-3-Clause GNU

The Requires

 

image silverstripe radio optionsetfield