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

@ -97,6 +97,16 @@ class Group extends DataObject
return $doSet; 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. * Caution: Only call on instances, not through a singleton.
* The "root group" fields will be created through {@link SecurityAdmin->EditForm()}. * The "root group" fields will be created through {@link SecurityAdmin->EditForm()}.
@ -116,7 +126,7 @@ class Group extends DataObject
$parentidfield = DropdownField::create( $parentidfield = DropdownField::create(
'ParentID', 'ParentID',
$this->fieldLabel('Parent'), $this->fieldLabel('Parent'),
Group::get()->exclude('ID', $this->ID)->map('ID', 'Breadcrumbs') $this->getDecodedBreadcrumbs()
)->setEmptyString(' '), )->setEmptyString(' '),
new TextareaField('Description', $this->fieldLabel('Description')) new TextareaField('Description', $this->fieldLabel('Description'))
), ),