silverstripe / silverstripe-framework

Silverstripe Framework, the MVC framework that powers Silverstripe CMS
https://www.silverstripe.org
BSD 3-Clause "New" or "Revised" License
720 stars 820 forks source link

TreeDropdownField -> DisableFunction not working #11208

Open icecaster opened 2 months ago

icecaster commented 2 months ago

Module version(s) affected

5

Description

TreeDropdownField & its subclasses (TreeMultiselectField)->DisableFunction not working

How to reproduce

This code should produce a dropdown field of all groups, none should be selectable:

$fields->addFieldToTab(
    "Root.Main",
    TreeMultiselectField::create("Test", "Test")
    ->setDisableFunction(function ($node) {
        return true;
    }
));

Possible Solution

No response

Additional Context

No response

Validations

GuySartorelli commented 1 month ago

~This was fixed as part of https://github.com/bringyourownideas/silverstripe-maintenance/pull/220 - because of the breadth of the changes it won't be tagged until the next minor release.~

GuySartorelli commented 1 month ago

Oops, wrong issue

maxime-rainville commented 1 month ago

Looks like this is a frontend problem. The nodes are marked as disabled in the JSON request. image

Just seems like the front end doesn't care. Arguably, we should probably have a check to make sure that you get block server side if you pick a disabled option.