diff --git a/code/PageElement.php b/code/PageElement.php index ec05aa5..4d12587 100644 --- a/code/PageElement.php +++ b/code/PageElement.php @@ -1,4 +1,5 @@ addFieldToTab('Root.PageSections', $this->getChildrenGridField()); } + $fields->addFieldsToTab("Root.Pages", ReadonlyField::create("Version", "Version", $this->Version)); + $config = GridFieldConfig_Base::create() + ->removeComponentsByType(GridFieldDataColumns::class) + ->addComponent($dataColumns = new GridFieldDataColumns()); + $dataColumns->setDisplayFields(["Title" => "Title", "getIsPublished" => "Is Published"]); + $gridField = GridField::create("Pages", "Pages", $this->Pages(), $config); + $fields->addFieldToTab("Root.Pages", $gridField); + return $fields; } diff --git a/code/PageSectionsExtension.php b/code/PageSectionsExtension.php index e8d3f36..76acb7d 100644 --- a/code/PageSectionsExtension.php +++ b/code/PageSectionsExtension.php @@ -93,4 +93,8 @@ public function PageSection($name = "Main") { array("Elements" => $elements, "ParentList" => strval($this->owner->ID)) ); } + + public function getIsPublished() { + return DBField::create_field("HTMLText", $this->owner->latestPublished() ? "Published" : "Draft"); + } } diff --git a/composer.json b/composer.json index 52767b5..d5b20ca 100644 --- a/composer.json +++ b/composer.json @@ -1,25 +1,24 @@ { - "name": "flxlabs/silverstripe-pagesections", - "version": "0.1.6", - "description": "Adds configurable page sections and elements to your SilverStripe project.", - "type": "silverstripe-module", - "homepage": "http://github.com/flxlabs/silverstripe-pagesections", - "keywords": ["silverstripe", "sections", "elements", "page sections", "page elements"], - "license": "MIT", - "authors": [ - { - "name": "Marco Crespi", - "email": "mrc@flxlabs.com" - } - ], - "support": { - "issues": "http://github.com/flxlabs/silverstripe-pagesections/issues" - }, - "require": { - "silverstripe/framework": "~3.6", - "flxlabs/silverstripe-versionedrelations": "^0.1.10" - }, - "extra": { - "installer-name": "pagesections" - } + "name": "flxlabs/silverstripe-pagesections", + "version": "0.1.6", + "description": "Adds configurable page sections and elements to your SilverStripe project.", + "type": "silverstripe-module", + "homepage": "http://github.com/flxlabs/silverstripe-pagesections", + "keywords": ["silverstripe", "sections", "elements", "page sections", "page elements"], + "license": "MIT", + "authors": [{ + "name": "Marco Crespi", + "email": "mrc@flxlabs.com" + }], + "support": { + "issues": "http://github.com/flxlabs/silverstripe-pagesections/issues" + }, + "require": { + "silverstripe/framework": "~3.7", + "flxlabs/silverstripe-versionedrelations": "^0.1.14", + "symbiote/silverstripe-gridfieldextensions": "^2.0.2" + }, + "extra": { + "installer-name": "pagesections" + } }