API Rename the DocumentSets tab name to remove spaces

This commit is contained in:
Raissa North 2017-12-01 14:29:41 +13:00
parent 2922e83dc1
commit 0d27e614cd
3 changed files with 15 additions and 5 deletions

View File

@ -26,7 +26,7 @@ class DMSSiteTreeExtension extends DataExtension
}
$gridField = GridField::create(
'Document Sets',
'DocumentSets',
false,
$this->owner->DocumentSets(), //->Sort('DocumentSort'),
$config = new GridFieldConfig_RelationEditor
@ -39,9 +39,17 @@ class DMSSiteTreeExtension extends DataExtension
);
$fields->addFieldToTab(
'Root.Document Sets (' . $this->owner->DocumentSets()->count() . ')',
'Root.DocumentSets',
$gridField
);
$fields
->findOrMakeTab('Root.DocumentSets')
->setTitle(_t(
__CLASS__ . '.DocumentSetsTabTitle',
'Document Sets ({count})',
array('count' => $this->owner->DocumentSets()->count())
));
}
/**

View File

@ -32,6 +32,8 @@ en:
SHOWONPAGE: Show on page
SINGULARNAME: Document Set
TAGS_RIGHT_TITLE: Tags can be set in the taxonomy area, and can be assigned when editing a document.
DMSSiteTreeExtension:
DocumentSetsTabTitle: 'Document Sets ({count})'
DMSDocumentTaxonomyExtension:
TAGS: Tags
NOTAGS: No tags found

View File

@ -22,7 +22,7 @@ class DMSSiteTreeExtensionTest extends SapphireTest
{
Config::inst()->update('SiteTree', 'documents_enabled', $configSetting);
$siteTree = $this->objFromFixture('SiteTree', 's2');
$this->$assertionMethod($siteTree->getCMSFields()->fieldByName('Root.Document Sets (1).Document Sets'));
$this->$assertionMethod($siteTree->getCMSFields()->fieldByName('Root.DocumentSets.DocumentSets'));
}
/**
@ -45,7 +45,7 @@ class DMSSiteTreeExtensionTest extends SapphireTest
{
Config::inst()->update('SiteTree', 'documents_enabled', true);
$siteTree = $this->objFromFixture('SiteTree', 's2');
$gridField = $siteTree->getCMSFields()->fieldByName('Root.Document Sets (1).Document Sets');
$gridField = $siteTree->getCMSFields()->fieldByName('Root.DocumentSets.DocumentSets');
$this->assertInstanceOf('GridField', $gridField);
$this->assertTrue((bool) $gridField->hasClass('documentsets'));
@ -90,7 +90,7 @@ class DMSSiteTreeExtensionTest extends SapphireTest
public function testGetRelatedDocumentsForAutocompleter()
{
$page = $this->objFromFixture('SiteTree', 's1');
$gridField = $page->getCMSFields()->fieldByName('Root.Document Sets (2).Document Sets');
$gridField = $page->getCMSFields()->fieldByName('Root.DocumentSets.DocumentSets');
$this->assertInstanceOf('GridField', $gridField);
$autocompleter = $gridField->getConfig()->getComponentByType('GridFieldAddExistingAutocompleter');