\OptionalTreeDropdownField
Extend SilverStripe TreeDropdownField to allow clearing a selection
Tested with SilverStripe 3.1.2
Usage:
$treeField = new OptionalTreeDropdownField('MyFieldID', 'My Field Title', 'SiteTree');
$treeField->setEmptyString('(Choose)');
Synopsis
class OptionalTreeDropdownField
extends TreeDropdownField
{
- // members
- private static array $allowed_actions = ;
- protected boolean $hasEmptyDefault = false;
- protected string $emptyString = '';
- // methods
- public void setHasEmptyDefault()
- public boolean getHasEmptyDefault()
- public void setEmptyString()
- public string getEmptyString()
- public string tree()
Hierarchy
Extends
- TreeDropdownField
Members
private
- $allowed_actions
protected
- $emptyString — string
- $hasEmptyDefault — boolean
Methods
public
- getEmptyString()
- getHasEmptyDefault()
- setEmptyString() — Set the default selection label, e.g. "select...".
- setHasEmptyDefault()
- tree() — Get the whole tree of a part of the tree via an AJAX request.