mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR Checking for valid field type in DataDifferencer (built-in fields like 'RecordClassName' can't be casted to a field object)
This commit is contained in:
parent
f37640b493
commit
67568b08a3
@ -154,6 +154,21 @@ class DataDifferencer extends ViewableData {
|
||||
if(in_array($field, $this->ignoredFields)) continue;
|
||||
|
||||
if(!$this->fromRecord || $this->fromRecord->$field != $this->toRecord->$field) {
|
||||
// Only show HTML diffs for fields which allow HTML values in the first place
|
||||
$fieldObj = $this->toRecord->dbObject($field);
|
||||
if($this->fromRecord) {
|
||||
$fieldDiff = Diff::compareHTML(
|
||||
$this->fromRecord->$field,
|
||||
$this->toRecord->$field,
|
||||
(!$fieldObj || $fieldObj->stat('escape_type') != 'xml')
|
||||
);
|
||||
} else {
|
||||
if($fieldObj && $fieldObj->stat('escape_type') == 'xml') {
|
||||
$fieldDiff = "<ins>" . $this->toRecord->$field . "</ins>";
|
||||
} else {
|
||||
$fieldDiff = "<ins>" . Convert::raw2xml($this->toRecord->$field) . "</ins>";
|
||||
}
|
||||
}
|
||||
$changedFields->push(new ArrayData(array(
|
||||
'Name' => $field,
|
||||
'Title' => $base->fieldLabel($field),
|
||||
|
Loading…
x
Reference in New Issue
Block a user