silverstripe/silverstripe-framework — pull request #2037 by kinglozzer (2013-05-30 11:51:31+00:00)
Title: FEATURE: Disable specific tree nodes in TreeDropdownField

DO NOT MERGE: to be reviewed.

This feature request was born out of wanting the ability to disable (for example) a top level page from being selected, while still being able to select a child page. Using `setFilterFunction()` simply removes the node and its children.

Usage example:
```php
$tree = new TreeMultiselectField('MyTree', 'My Tree', 'SiteTree');

$tree->setDisableFunction(function($obj) {
return ($obj->ClassName == "DisableMe");
});
```

Appearance of a disabled node:
![screen shot 2013-05-30 at 12 49 56](https://f.cloud.github.com/assets/1655548/584616/2142d478-c91f-11e2-98fc-d0ae0e95b072.jpg)