PHPackages                             pixelpoems/silverstripe-selection-field - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. pixelpoems/silverstripe-selection-field

ActiveSilverstripe-vendormodule[Utility &amp; Helpers](/categories/utility)

pixelpoems/silverstripe-selection-field
=======================================

Silverstripe Module that provides a selection field for the CMS.

2.0.1(2mo ago)041511BSD-3-ClausePHPPHP ^8.3

Since Sep 28Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/pixelpoems/silverstripe-selection-field)[ Packagist](https://packagist.org/packages/pixelpoems/silverstripe-selection-field)[ RSS](/packages/pixelpoems-silverstripe-selection-field/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (8)Versions (8)Used By (1)

Silverstripe Selection Field
============================

[](#silverstripe-selection-field)

[![stability-beta](https://camo.githubusercontent.com/36eced06ca8bf4d0320406cbe1eacb0dbca16e6726c978d54c184e7676204dee/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73746162696c6974792d626574612d3333626266662e737667)](https://github.com/mkenney/software-guides/blob/master/STABILITY-BADGES.md#beta)

This module provides a selection field wich is based on [color palate field by heyday](https://github.com/heyday/silverstripe-colorpalette).

- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)
- [Reporting Issues](#reporting-issues)
- [Credits](#credits)

Requirements
------------

[](#requirements)

- Silverstripe CMS ^6.0
- Silverstripe Framework ^6.0
- Silverstripe Color Palette Field ^4.0 ()

Installation
------------

[](#installation)

```
composer require pixelpoems/silverstripe-selection-field

```

Usage
-----

[](#usage)

Based on: `SilverStripe\Forms\OptionsetField` and `Heyday\ColorPalette\Fields\ColorPaletteField`

```
private static $db = [
    'Alignment' => 'Varchar',
];

private static $defaults = [
    'Alignment' => 'left',
];

public function getCMSFields()
{
    $fields = parent::getCMSFields();

    $fields->addFieldsToTab('Root.Main', [

        SelectionField::create(
            $name = 'Alignment',
            $title = 'Alignment',
            $source = [
                'left' => [
                    'Value' => 'left',
                    'Title' => _t('LayoutOptions.Left', "Left"),
                    'ShowTitle' => true,
                    'Icon' => 'align-left'
                ],
                'center' => [
                    'Value' => 'center',
                    'Title' => _t('LayoutOptions.Center', "Center"),
                    'ShowTitle' => true,
                    'Icon' => 'align-center'
                ],
                'right' => [
                    'Value' => 'right',
                    'Title' => _t('LayoutOptions.Right', "Right"),
                    'ShowTitle' => true,
                    'Icon' => 'align-right'
                ],
                $value = 'left'
        ])
    ]);

    return $fields;
}
```

[![example-alignment-fa.png](resources%2Fexample-alignment-fa.png)](resources%2Fexample-alignment-fa.png)

To display Icons you need to reference Font Awesome Icons (Free &amp; Solid): [https://fontawesome.com](https://fontawesome.com/search?q=left&o=r&m=free)Use the name of the icon without the `fa-` prefix. e.g. `align-left` for `fa-align-left`.

If no Icon is defined within the array, the box will display the title! You can define an alternative box content when you define "Content" within Options. Furthermore you can define an image link:

```
'medium' => [
    'Value' => 'medium',
    'Title' => _t('LayoutOptions.Medium', 'Medium'),
    'ShowTitle' => true,
    'Content' => 'M',
    'ImgLink' => '/assets/medium.png'
],
```

If you defined an icon and an image link, the image link will be ignored. Based on hierarchy the icon will be displayed first, then the image link and then the content - if nothing is defined, the title will be displayed.

If you use ImgLink, you can let the user upload the images to a predefined folder. You can use the `Icon Selection Service`, which comes with this module, to provide the images to the user. You can use the following code to provide the images:

```
private static array $db = [
    'IconID' => 'Varchar'
];

public function getCMSFields()
{
    $fields = parent::getCMSFields();

    $fields->addFieldsToTab('Root.Main', [
        SelectionField::create('IconID', 'Icon', IconSelectionService::getIconOptions())
    ]);

    return $fields;
}
```

Reporting Issues
----------------

[](#reporting-issues)

Please [create an issue](https://github.com/pixelpoems/silverstripe-selection-field/issues) for any bugs you've found, or features you're missing.

Credits
-------

[](#credits)

Icons from [Font Awesome](https://fontawesome.com/)
Selection Field is based on [Heyday's Color Palette Field](https://github.com/heyday/silverstripe-colorpalette)

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance86

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 93.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~148 days

Recently: every ~203 days

Total

7

Last Release

69d ago

Major Versions

1.1.1 → 2.0.02025-10-13

PHP version history (2 changes)1.0.0PHP &gt;=7.4

2.0.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/2b45ea1277a7072f51fde6587ca46092d1ac996734aed8e085f2b3481742fe3f?d=identicon)[pixelpoems](/maintainers/pixelpoems)

---

Top Contributors

[![BettinaMaria98](https://avatars.githubusercontent.com/u/50010683?v=4)](https://github.com/BettinaMaria98 "BettinaMaria98 (15 commits)")[![andreassp](https://avatars.githubusercontent.com/u/2562181?v=4)](https://github.com/andreassp "andreassp (1 commits)")

---

Tags

silverstripefield

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pixelpoems-silverstripe-selection-field/health.svg)

```
[![Health](https://phpackages.com/badges/pixelpoems-silverstripe-selection-field/health.svg)](https://phpackages.com/packages/pixelpoems-silverstripe-selection-field)
```

###  Alternatives

[silverstripe/tagfield

Tag field for SilverStripe

571.2M45](/packages/silverstripe-tagfield)[kinglozzer/multiselectfield

A sortable multiple select field for managing many-to-many relations

1341.2k2](/packages/kinglozzer-multiselectfield)[burnbright/silverstripe-externalurlfield

Provides SilverStripe with a DBField and FormField for handling external URLs.

109.6k1](/packages/burnbright-silverstripe-externalurlfield)[adrhumphreys/silverstripe-textdropdownfield

A text field combined with a dropdown field.

106.1k](/packages/adrhumphreys-silverstripe-textdropdownfield)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
