Merge pull request #9198 from elabuwa/pulls/4.3/bug-fix-html-entities-breadcrumbs-in-group

Bug : Add html_entity_decode to group parents
This commit is contained in:
Robbie Averill 2019-08-30 09:51:52 +12:00 committed by GitHub
commit 0b991cc039
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -96,6 +96,16 @@ class Group extends DataObject
return $doSet;
}
private function getDecodedBreadcrumbs()
{
$list = Group::get()->exclude('ID', $this->ID);
$groups = ArrayList::create();
foreach ($list as $group) {
$groups->push(['ID' => $group->ID, 'Title' => $group->getBreadcrumbs(' » ')]);
}
return $groups;
}
/**
* Caution: Only call on instances, not through a singleton.
@ -116,7 +126,7 @@ class Group extends DataObject
$parentidfield = DropdownField::create(
'ParentID',
$this->fieldLabel('Parent'),
Group::get()->exclude('ID', $this->ID)->map('ID', 'Breadcrumbs')
$this->getDecodedBreadcrumbs()
)->setEmptyString(' '),
new TextareaField('Description', $this->fieldLabel('Description'))
),