diff --git a/code/DMSDocument.php b/code/DMSDocument.php index 2b09dde..f6813d9 100644 --- a/code/DMSDocument.php +++ b/code/DMSDocument.php @@ -142,7 +142,7 @@ class DMSDocument extends DataObject implements DMSDocumentInterface { * @param null $value String of the value of the tag to get * @return array of Strings of all the tags or null if there is no match found */ - function getTags($category, $value = null) { + function getTagsList($category, $value = null) { $tags = $this->getTagsObjects($category, $value); //convert DataList into array of Values @@ -458,5 +458,9 @@ class DMSDocument_Controller extends Controller { $this->httpError(404, 'This asset does not exist.'); } + + function getCMSFields() { + return parent::getCMSFields(); + } } diff --git a/code/DMSSiteTreeExtension.php b/code/DMSSiteTreeExtension.php index 4ad10e9..c038c06 100644 --- a/code/DMSSiteTreeExtension.php +++ b/code/DMSSiteTreeExtension.php @@ -5,7 +5,7 @@ class DMSSiteTreeExtension extends DataExtension { 'Documents' => 'DMSDocument' ); - function updateCMSFields(&$fields){ + function updateCMSFields(FieldList $fields){ $documentsListConfig = GridFieldConfig_RecordEditor::create(); $modelClass = DMS::$modelClass; $documentsListConfig->getComponentByType('GridFieldDataColumns')->setDisplayFields($modelClass::$display_fields); @@ -13,7 +13,7 @@ class DMSSiteTreeExtension extends DataExtension { $fields->addFieldToTab( 'Root.Documents', GridField::create( - 'Documents', + 'Documents', false, $this->owner->Documents(), $documentsListConfig diff --git a/code/interface/DMSDocumentInterface.php b/code/interface/DMSDocumentInterface.php index 1636ba9..a699f38 100644 --- a/code/interface/DMSDocumentInterface.php +++ b/code/interface/DMSDocumentInterface.php @@ -79,7 +79,7 @@ interface DMSDocumentInterface { * @param null $value String of the value of the tag to get * @return array of Strings of all the tags or null if there is no match found */ - function getTags($category, $value = null); + function getTagsList($category, $value = null); /** * Quick way to add multiple tags to a DMSDocument. This takes a multidimensional array of category/value pairs. diff --git a/tests/DMSTagTest.php b/tests/DMSTagTest.php index 7dade60..46c955c 100644 --- a/tests/DMSTagTest.php +++ b/tests/DMSTagTest.php @@ -26,7 +26,7 @@ class DMSTagTest extends SapphireTest { $doc->addTag("company","apple"); $doc->addTag("company","SilverStripe"); - $fruits = $doc->getTags("fruit"); + $fruits = $doc->getTagsList("fruit"); $this->assertNotNull($fruits,"Something returned for fruit tags"); $this->assertEquals(count($fruits),3,"3 fruit tags returned"); $this->assertTrue(in_array("banana",$fruits),"correct fruit tags returned"); @@ -38,7 +38,7 @@ class DMSTagTest extends SapphireTest { $doc2->write(); $doc2->addTag("fruit","banana"); - $fruits = $doc2->getTags("fruit"); + $fruits = $doc2->getTagsList("fruit"); $this->assertNotNull($fruits,"Something returned for fruit tags"); $this->assertEquals(count($fruits),1,"Only 1 fruit tags returned"); @@ -46,7 +46,7 @@ class DMSTagTest extends SapphireTest { $doc->removeAllTags(); //banana fruit remains - $fruits = $doc2->getTags("fruit"); + $fruits = $doc2->getTagsList("fruit"); $this->assertNotNull($fruits,"Something returned for fruit tags"); $this->assertEquals(count($fruits),1,"Only 1 fruit tags returned"); @@ -72,41 +72,41 @@ class DMSTagTest extends SapphireTest { $doc->addTag("company","apple"); $doc->addTag("company","SilverStripe"); - $companies = $doc->getTags("company"); + $companies = $doc->getTagsList("company"); $this->assertNotNull($companies,"Companies returned before deletion"); $this->assertEquals(count($companies),2,"Two companies returned before deletion"); //delete an entire category $doc->removeTag("company"); - $companies = $doc->getTags("company"); + $companies = $doc->getTagsList("company"); $this->assertNull($companies,"All companies deleted"); - $fruit = $doc->getTags("fruit"); + $fruit = $doc->getTagsList("fruit"); $this->assertEquals(count($fruit),3,"Three fruits returned before deletion"); //delete a single tag $doc->removeTag("fruit","apple"); - $fruit = $doc->getTags("fruit"); + $fruit = $doc->getTagsList("fruit"); $this->assertEquals(count($fruit),2,"Two fruits returned after deleting one"); //delete a single tag $doc->removeTag("fruit","orange"); - $fruit = $doc->getTags("fruit"); + $fruit = $doc->getTagsList("fruit"); $this->assertEquals(count($fruit),1,"One fruits returned after deleting two"); //nothing happens when deleting tag that doesn't exist $doc->removeTag("fruit","jellybean"); - $fruit = $doc->getTags("fruit"); + $fruit = $doc->getTagsList("fruit"); $this->assertEquals(count($fruit),1,"One fruits returned after attempting to delete non-existent fruit"); //delete the last fruit $doc->removeTag("fruit","banana"); - $fruit = $doc->getTags("fruit"); + $fruit = $doc->getTagsList("fruit"); $this->assertNull($fruit,"All fruits deleted"); $tags = DataObject::get("DMSTag");