Closed Cheddam closed 3 years ago
Gah, looks like this was already raised https://github.com/silverstripe/silverstripe-framework/issues/9839
That issue has some additional detail on the 'CWP specifics' too:
install CWP (this is not requried - any manymany or manyone relationship is needed to break it. This is a module that adds Taxonomy to all page types which will break the diff view)
@Cheddam I'll leave it to you which one you want to keep open.
Fixed in silverstripe/silverstripe-versioned-admin#197.
The reference to the PR in which it was fixed in your comment @Cheddam resolves to this repo and it should be the versioned-admin repo instead, so I was like... 2012 PR? :-D
Whoops, fixed @michalkleiner 😅
Affected Version
CMS Recipe 4.7.0 and later
Description
The changes introduced in #9604 added custom behaviour for the
setValue()
method onTreeMultiselectField
. Before, it would directly set whatever$value
was passed (generallynull
or a scalar value), but now it attempts to set the value to a relationship matching the field name, which can result in aManyManyList
being set as the value.This causes issues when the field is transformed into a DiffField. When generating the form schema for this field, it tries to pull the value of the original
TreeMultiselectField
and pass it to theDiff::compareHTML()
method, which only supports scalar / array values.A primary example of this problem is that if a
TreeMultiselectField
is added to aDataObject
that has a History view, the comparison feature of the History view will cease to function. This directly impacts the CWP recipe, which adds aTreeMultiselectField
to all pagetypes to manage Taxonomy Terms.(It's worth noting that AFAICT,
DiffField
's handling ofTreeMultiselectField
was broken before this, too - it just resulted an empty diff, rather than throwing an exception.)Steps to Reproduce
cwp/cwp-installer
recipePossible solutions
I believe the change in behaviour introduced by #9604 still makes sense, so to me the best course of action would be stopping DiffField from attempting to diff unsupported values, or possibly transforming said values before diffing them.