mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
FIX Update alternateTreeTitle to updateTreeTitle
This commit is contained in:
parent
e129cafa94
commit
38031887a9
@ -123,20 +123,20 @@ class GroupSubsites extends DataExtension implements PermissionProvider
|
||||
}
|
||||
|
||||
/**
|
||||
* If this group belongs to a subsite,
|
||||
* append the subsites title to the group title
|
||||
* to make it easy to distinguish in the tree-view
|
||||
* of the security admin interface.
|
||||
* If this group belongs to a subsite, append the subsites title to the group title to make it easy to
|
||||
* distinguish in the tree-view of the security admin interface.
|
||||
*
|
||||
* @param string $title
|
||||
*/
|
||||
public function alternateTreeTitle()
|
||||
public function updateTreeTitle(&$title)
|
||||
{
|
||||
if ($this->owner->AccessAllSubsites) {
|
||||
$title = _t('GroupSubsites.GlobalGroup', 'global group');
|
||||
return htmlspecialchars($this->owner->Title, ENT_QUOTES) . ' <i>(' . $title . ')</i>';
|
||||
$title = htmlspecialchars($this->owner->Title, ENT_QUOTES) . ' <i>(' . $title . ')</i>';
|
||||
} else {
|
||||
$subsites = Convert::raw2xml(implode(', ', $this->owner->Subsites()->column('Title')));
|
||||
$title = htmlspecialchars($this->owner->Title) . " <i>($subsites)</i>";
|
||||
}
|
||||
|
||||
$subsites = Convert::raw2xml(implode(', ', $this->owner->Subsites()->column('Title')));
|
||||
return htmlspecialchars($this->owner->Title) . " <i>($subsites)</i>";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -15,8 +15,8 @@ class GroupSubsitesTest extends BaseSubsiteTest
|
||||
|
||||
public function testTrivialFeatures()
|
||||
{
|
||||
$this->assertTrue(is_array(singleton(GroupSubsites::class)->extraStatics()));
|
||||
$this->assertTrue(is_array(singleton(GroupSubsites::class)->providePermissions()));
|
||||
$this->assertInternalType('array', singleton(GroupSubsites::class)->extraStatics());
|
||||
$this->assertInternalType('array', singleton(GroupSubsites::class)->providePermissions());
|
||||
$this->assertInstanceOf(FieldList::class, singleton(Group::class)->getCMSFields());
|
||||
}
|
||||
|
||||
@ -25,11 +25,13 @@ class GroupSubsitesTest extends BaseSubsiteTest
|
||||
$group = new Group();
|
||||
$group->Title = 'The A Team';
|
||||
$group->AccessAllSubsites = true;
|
||||
$this->assertEquals($group->getTreeTitle(), 'The A Team <i>(global group)</i>');
|
||||
$this->assertEquals('The A Team <i>(global group)</i>', $group->getTreeTitle());
|
||||
|
||||
$group->AccessAllSubsites = false;
|
||||
$group->write();
|
||||
|
||||
$group->Subsites()->add($this->objFromFixture(Subsite::class, 'domaintest1'));
|
||||
$group->Subsites()->add($this->objFromFixture(Subsite::class, 'domaintest2'));
|
||||
$this->assertEquals($group->getTreeTitle(), 'The A Team <i>(Test 1, Test 2)</i>');
|
||||
$this->assertEquals('The A Team <i>(Test 1, Test 2)</i>', $group->getTreeTitle());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user