From d023300626dffaeb0f136743e0a246045efeee25 Mon Sep 17 00:00:00 2001 From: Julian Seidenberg Date: Mon, 27 Aug 2012 14:20:21 +1200 Subject: [PATCH] ENHANCEMENT: not showing the Documents tab on certain pages --- code/DMSSiteTreeExtension.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/code/DMSSiteTreeExtension.php b/code/DMSSiteTreeExtension.php index a1e4b81..019c327 100644 --- a/code/DMSSiteTreeExtension.php +++ b/code/DMSSiteTreeExtension.php @@ -5,7 +5,26 @@ class DMSSiteTreeExtension extends DataExtension { 'Documents' => 'DMSDocument' ); + static $noDocumentsList = array( + ); + + /** + * Do not show the documents tab on the array of pages set here + * @static + * @param $mixed Array of page types to not show the Documents tab on + */ + static function no_documents_tab($array) { + if (is_array($array)) { + self::$noDocumentsList = $array; + } else { + self::$noDocumentsList = array($array); + } + } + function updateCMSFields(FieldList $fields){ + //prevent certain pages from having a Document tab in the CMS + if (in_array($this->owner->ClassName,self::$noDocumentsList)) return; + //javascript to customize the grid field for the DMS document (overriding entwine in FRAMEWORK_DIR.'/javascript/GridField.js' Requirements::javascript('dms/javascript/DMSGridField.js'); Requirements::css('dms/css/DMSMainCMS.css');