PHPackages                             exadium/extra-attributes-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. exadium/extra-attributes-field

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

exadium/extra-attributes-field
==============================

Extension of SilverStripe form fields to allow attributes for child elements on dropdown (option) and checkboxset (checkbox) fields.

64.4k2[1 PRs](https://github.com/marijnkampf/silverstripe-extra-attributes-field/pulls)PHP

Since Dec 18Pushed 10y ago1 watchersCompare

[ Source](https://github.com/marijnkampf/silverstripe-extra-attributes-field)[ Packagist](https://packagist.org/packages/exadium/extra-attributes-field)[ RSS](/packages/exadium-extra-attributes-field/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Extra Attributes Field module
=============================

[](#extra-attributes-field-module)

Description
-----------

[](#description)

Extension of SilverStripe form fields to allow adding attributes to child elements on dropdown and checkboxset fields.

Maintainer Contact
------------------

[](#maintainer-contact)

Marijn Kampf &lt;marijn (at) exadium (dot) com&gt;

Sponsored by
------------

[](#sponsored-by)

Exadium Web Development and Online Marketing. Visit  for more information.

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

[](#installation)

```
composer require "exadium/extra-attributes-field":"*"

```

The module should work out of the box on a standard installation of SilverStripe. If you have Bootstrap Forms module installed by

\\extra-attributes-field\\templates
\\themes\\bootstrap\\templates

Usage
-----

[](#usage)

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

	$count = array('1' => 'One', '2' => 'Two', '3' => 'Three');
	$batties = array('1' => 'Batty', '2' => 'Batty batty', '3' => 'Batty batty batty');

	$fields->push(
		DropdownAttributesField::create('DropdownAttributesCount', 'DropdownAttributesField Count', $count)
			->setOptionsAttributes('data-bats', $batties)
	);

	$fields->push(
		CheckboxSetField::create('CheckCount', 'CheckboxSetField Count', $count)
			->setOptionsAttributes('data-bats', $batties)
	);

	return $fields;
}

```

Generates code like

```

	DropdownAttributesField Count

			One
			Two
			Three

	CheckboxSetField Count

				One

				Two

				Three

```

Or you can load from a database field map. Also shows adding multiple options.

```
$fields->push(
	DropdownAttributesField::create('Members', 'Members', Member::get()->map('ID', 'Name'))
		->setOptionsAttributes('data-email', Member::get()->map('ID', 'Email'))
		->setOptionsAttributes('data-firstname', Member::get()->map('ID', 'FirstName'))
);

```

Notes
-----

[](#notes)

If you use [silverstripe-bootstrap-forms](https://github.com/unclecheese/silverstripe-bootstrap-forms) copy BootstrapCheckboxSetField.ss to your templates folder. If you use your own custom Field templates add

```
$OptionAttributesHTML

```

to your input/option/checkbox/...

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

[](#requirements)

SilverStripe 3.1

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/167025983?v=4)[exadium](/maintainers/exadium)[@Exadium](https://github.com/Exadium)

---

Top Contributors

[![marijnkampf](https://avatars.githubusercontent.com/u/699259?v=4)](https://github.com/marijnkampf "marijnkampf (10 commits)")

### Embed Badge

![Health badge](/badges/exadium-extra-attributes-field/health.svg)

```
[![Health](https://phpackages.com/badges/exadium-extra-attributes-field/health.svg)](https://phpackages.com/packages/exadium-extra-attributes-field)
```

PHPackages © 2026

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