Skip to content

fullscreeninteractive/silverstripe-dropdownimagefield

Repository files navigation

DropdownImageField

Adds a DropdownImageField field which enables you to display images alongside the captions. Uses a plugin for Chosen.js (which is used by SS), Image-Select. The plugin is modified.

Working screenshot

Requirements

SilverStripe 4.0+

Usage

Example:

DropdownImageField::create('LanguageID', 'Select language',
	LanguageObj::get(), // Source for items.
	'ID',		// Key field on item.
	'Title',	// Caption field on item.
	'Icon'		// Image field on item. Can be a method/relation that returns an image.
)

Notes

This plugin uses a setTimeout function with additional parameters. A polyfill is loaded to support IE9 and lower.