briceburg/silverstripe-flexichoice

SilverStripe field for providing arbitrary text input or selecting from YAML configurable presets.

0.1.0 2015-01-28 04:11 UTC

This package is not auto-updated.

Last update: 2024-07-02 14:52:27 UTC


README

silverstripe-flexichoice

SilverStripe field for providing arbitrary text input or selecting from YAML configurable presets.

Requirements

SilverStripe 3+

Screenshots

flexichoice field

(the 'Link Text' field demonstrates a FlexiChoiceField, the 'Link' field is a silverstripe-flexilink field)

Usage

  • Add FlexiChoice field types to your DataObject(s)
class BlockContentHeading extends DataObject {
  private static $db = array(
    'Title'     => 'Varchar',
    'Content'   => 'Text',
    'Link'      => 'FlexiLink',
    'LinkText'  => 'FlexiChoice', // <--- here
  );
  

Trigger the environment builder (/dev/build) after extending objects -- You will now see the FlexiChoiceField appear in the CMS when editing your object.

FlexiChoiceField:
  choices:
    - LEARN MORE
    - READ MORE
    - MORE
    - GET STARTED

You may of course subclass FlexiChoiceField to provide multiple fields with different choice selections.