joshkosmala/silverstripe-hierarchicalcheckboxsetfield

A SilverStripe form field for adding nested checkboxes using parent and child dataobjects

dev-master 2016-04-19 02:43 UTC

This package is not auto-updated.

Last update: 2024-04-24 14:01:51 UTC


README

This field will produce a set of nested checkboxes.

The source can be a Hierarchy of dataobjects, or a multi dimensional array.

The values can be a be an array or a string.

Usage

$field = HierarchicalCheckboxSetField::create("Pages", "Pages", 
	Page::get()
		->filter("ParentID", 0),
	"Children",
	Page::get()
		->filter("ParentID", 0)
		->filter("ShowInMenus", true)
		->map('ID','ID')
		->toArray()
);
$field->setChildSort("Title DESC");
$field->setChildFilter("ShowInSearch = 1");