mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge branch '4.1' into 4
This commit is contained in:
commit
d02c15150b
@ -992,6 +992,9 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
'Title' => CMSPagesController::menu_title(),
|
'Title' => CMSPagesController::menu_title(),
|
||||||
'Link' => ($unlinked) ? false : $this->LinkPages()
|
'Link' => ($unlinked) ? false : $this->LinkPages()
|
||||||
)));
|
)));
|
||||||
|
|
||||||
|
$this->extend('updateBreadcrumbs', $items);
|
||||||
|
|
||||||
return $items;
|
return $items;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1009,6 +1012,8 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->extend('updateBreadcrumbs', $items);
|
||||||
|
|
||||||
return $items;
|
return $items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ namespace SilverStripe\CMS\Controllers;
|
|||||||
|
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
|
use SilverStripe\ORM\ArrayList;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\View\ArrayData;
|
use SilverStripe\View\ArrayData;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
@ -33,33 +34,32 @@ class CMSPagesController extends CMSMain
|
|||||||
|
|
||||||
public function Breadcrumbs($unlinked = false)
|
public function Breadcrumbs($unlinked = false)
|
||||||
{
|
{
|
||||||
$items = parent::Breadcrumbs($unlinked);
|
$this->beforeExtending('updateBreadcrumbs', function (ArrayList $items) {
|
||||||
|
//special case for building the breadcrumbs when calling the listchildren Pages ListView action
|
||||||
|
if ($parentID = $this->getRequest()->getVar('ParentID')) {
|
||||||
|
$page = SiteTree::get()->byID($parentID);
|
||||||
|
|
||||||
//special case for building the breadcrumbs when calling the listchildren Pages ListView action
|
//build a reversed list of the parent tree
|
||||||
if ($parentID = $this->getRequest()->getVar('ParentID')) {
|
$pages = array();
|
||||||
$page = SiteTree::get()->byID($parentID);
|
while ($page) {
|
||||||
|
array_unshift($pages, $page); //add to start of array so that array is in reverse order
|
||||||
|
$page = $page->Parent;
|
||||||
|
}
|
||||||
|
|
||||||
//build a reversed list of the parent tree
|
//turns the title and link of the breadcrumbs into template-friendly variables
|
||||||
$pages = array();
|
$params = array_filter(array(
|
||||||
while ($page) {
|
'view' => $this->getRequest()->getVar('view'),
|
||||||
array_unshift($pages, $page); //add to start of array so that array is in reverse order
|
'q' => $this->getRequest()->getVar('q')
|
||||||
$page = $page->Parent;
|
));
|
||||||
|
foreach ($pages as $page) {
|
||||||
|
$params['ParentID'] = $page->ID;
|
||||||
|
$item = new stdClass();
|
||||||
|
$item->Title = $page->Title;
|
||||||
|
$item->Link = Controller::join_links($this->Link(), '?' . http_build_query($params));
|
||||||
|
$items->push(new ArrayData($item));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
//turns the title and link of the breadcrumbs into template-friendly variables
|
return parent::Breadcrumbs($unlinked);
|
||||||
$params = array_filter(array(
|
|
||||||
'view' => $this->getRequest()->getVar('view'),
|
|
||||||
'q' => $this->getRequest()->getVar('q')
|
|
||||||
));
|
|
||||||
foreach ($pages as $page) {
|
|
||||||
$params['ParentID'] = $page->ID;
|
|
||||||
$item = new stdClass();
|
|
||||||
$item->Title = $page->Title;
|
|
||||||
$item->Link = Controller::join_links($this->Link(), '?' . http_build_query($params));
|
|
||||||
$items->push(new ArrayData($item));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $items;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ class CMSSiteTreeFilter_ChangedPages extends CMSSiteTreeFilter
|
|||||||
|
|
||||||
public static function title()
|
public static function title()
|
||||||
{
|
{
|
||||||
return _t('SilverStripe\\CMS\\Controllers\\CMSSiteTreeFilter_ChangedPages.Title', "Modified pages");
|
return _t(__CLASS__ . '.Title', "Modified pages");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFilteredPages()
|
public function getFilteredPages()
|
||||||
|
@ -25,7 +25,7 @@ class CMSSiteTreeFilter_DeletedPages extends CMSSiteTreeFilter
|
|||||||
|
|
||||||
public static function title()
|
public static function title()
|
||||||
{
|
{
|
||||||
return _t('SilverStripe\\CMS\\Controllers\\CMSSiteTreeFilter_DeletedPages.Title', "All pages, including archived");
|
return _t(__CLASS__ . '.Title', "All pages, including archived");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFilteredPages()
|
public function getFilteredPages()
|
||||||
|
@ -20,7 +20,7 @@ class CMSSiteTreeFilter_PublishedPages extends CMSSiteTreeFilter
|
|||||||
*/
|
*/
|
||||||
public static function title()
|
public static function title()
|
||||||
{
|
{
|
||||||
return _t('SilverStripe\\CMS\\Controllers\\CMSSIteTreeFilter_PublishedPages.Title', "Published pages");
|
return _t(__CLASS__ . '.Title', "Published pages");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace SilverStripe\CMS\Controllers;
|
namespace SilverStripe\CMS\Controllers;
|
||||||
|
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
@ -10,7 +11,7 @@ class CMSSiteTreeFilter_Search extends CMSSiteTreeFilter
|
|||||||
|
|
||||||
public static function title()
|
public static function title()
|
||||||
{
|
{
|
||||||
return _t('SilverStripe\\CMS\\Controllers\\CMSSiteTreeFilter_Search.Title', "All pages");
|
return _t(__CLASS__ . '.Title', "All pages");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,7 +24,7 @@ class CMSSiteTreeFilter_StatusDeletedPages extends CMSSiteTreeFilter
|
|||||||
|
|
||||||
public static function title()
|
public static function title()
|
||||||
{
|
{
|
||||||
return _t('SilverStripe\\CMS\\Controllers\\CMSSiteTreeFilter_StatusDeletedPages.Title', 'Archived pages');
|
return _t(__CLASS__ . '.Title', 'Archived pages');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,7 +14,7 @@ class CMSSiteTreeFilter_StatusDraftPages extends CMSSiteTreeFilter
|
|||||||
|
|
||||||
public static function title()
|
public static function title()
|
||||||
{
|
{
|
||||||
return _t('SilverStripe\\CMS\\Controllers\\CMSSiteTreeFilter_StatusDraftPages.Title', 'Draft pages');
|
return _t(__CLASS__ . '.Title', 'Draft pages');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,7 +14,7 @@ class CMSSiteTreeFilter_StatusRemovedFromDraftPages extends CMSSiteTreeFilter
|
|||||||
|
|
||||||
public static function title()
|
public static function title()
|
||||||
{
|
{
|
||||||
return _t('SilverStripe\\CMS\\Controllers\\CMSSiteTreeFilter_StatusRemovedFromDraftPages.Title', 'Live but removed from draft');
|
return _t(__CLASS__ . '.Title', 'Live but removed from draft');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -121,22 +121,23 @@ abstract class SilverStripeNavigatorItem extends ViewableData
|
|||||||
*/
|
*/
|
||||||
public function isArchived()
|
public function isArchived()
|
||||||
{
|
{
|
||||||
$recordClass = get_class($this->record);
|
/** @var Versioned|DataObject $record */
|
||||||
if (!$recordClass::has_extension(Versioned::class)) {
|
$record = $this->record;
|
||||||
|
if (!$record->hasExtension(Versioned::class) || !$record->hasStages()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($this->record->_cached_isArchived)) {
|
if (!isset($record->_cached_isArchived)) {
|
||||||
$baseClass = $this->record->baseClass();
|
$baseClass = $record->baseClass();
|
||||||
$currentDraft = Versioned::get_by_stage($baseClass, Versioned::DRAFT)->byID($this->record->ID);
|
$currentDraft = Versioned::get_by_stage($baseClass, Versioned::DRAFT)->byID($record->ID);
|
||||||
$currentLive = Versioned::get_by_stage($baseClass, Versioned::LIVE)->byID($this->record->ID);
|
$currentLive = Versioned::get_by_stage($baseClass, Versioned::LIVE)->byID($record->ID);
|
||||||
|
|
||||||
$this->record->_cached_isArchived = (
|
$record->_cached_isArchived = (
|
||||||
(!$currentDraft || ($currentDraft && $this->record->Version != $currentDraft->Version))
|
(!$currentDraft || ($currentDraft && $record->Version != $currentDraft->Version))
|
||||||
&& (!$currentLive || ($currentLive && $this->record->Version != $currentLive->Version))
|
&& (!$currentLive || ($currentLive && $record->Version != $currentLive->Version))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->record->_cached_isArchived;
|
return $record->_cached_isArchived;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ namespace SilverStripe\CMS\Controllers;
|
|||||||
use SilverStripe\CMS\Model\RedirectorPage;
|
use SilverStripe\CMS\Model\RedirectorPage;
|
||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\Core\Convert;
|
use SilverStripe\Core\Convert;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\ORM\FieldType\DBDatetime;
|
use SilverStripe\ORM\FieldType\DBDatetime;
|
||||||
use SilverStripe\ORM\FieldType\DBField;
|
use SilverStripe\ORM\FieldType\DBField;
|
||||||
use SilverStripe\Versioned\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
@ -53,12 +54,14 @@ class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem
|
|||||||
|
|
||||||
public function canView($member = null)
|
public function canView($member = null)
|
||||||
{
|
{
|
||||||
$recordClass = get_class($this->record);
|
/** @var Versioned|DataObject $record */
|
||||||
|
$record = $this->record;
|
||||||
return (
|
return (
|
||||||
$recordClass::has_extension(Versioned::class)
|
$record->hasExtension(Versioned::class)
|
||||||
|
&& $record->hasStages()
|
||||||
&& $this->isArchived()
|
&& $this->isArchived()
|
||||||
// Don't follow redirects in preview, they break the CMS editing form
|
// Don't follow redirects in preview, they break the CMS editing form
|
||||||
&& !($this->record instanceof RedirectorPage)
|
&& !($record instanceof RedirectorPage)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ namespace SilverStripe\CMS\Controllers;
|
|||||||
use SilverStripe\CMS\Model\RedirectorPage;
|
use SilverStripe\CMS\Model\RedirectorPage;
|
||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\Core\Convert;
|
use SilverStripe\Core\Convert;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\Versioned\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
|
|
||||||
class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem
|
class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem
|
||||||
@ -51,9 +52,11 @@ class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem
|
|||||||
|
|
||||||
public function canView($member = null)
|
public function canView($member = null)
|
||||||
{
|
{
|
||||||
$recordClass = get_class($this->record);
|
/** @var Versioned|DataObject $record */
|
||||||
|
$record = $this->record;
|
||||||
return (
|
return (
|
||||||
$recordClass::has_extension(Versioned::class)
|
$record->hasExtension(Versioned::class)
|
||||||
|
&& $record->hasStages()
|
||||||
&& $this->getLivePage()
|
&& $this->getLivePage()
|
||||||
// Don't follow redirects in preview, they break the CMS editing form
|
// Don't follow redirects in preview, they break the CMS editing form
|
||||||
&& !($this->record instanceof RedirectorPage)
|
&& !($this->record instanceof RedirectorPage)
|
||||||
|
@ -5,6 +5,7 @@ use SilverStripe\CMS\Model\RedirectorPage;
|
|||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\Core\ClassInfo;
|
use SilverStripe\Core\ClassInfo;
|
||||||
use SilverStripe\Core\Convert;
|
use SilverStripe\Core\Convert;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\Versioned\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SiteTreeFutureState;
|
use SiteTreeFutureState;
|
||||||
|
|
||||||
@ -57,11 +58,14 @@ class SilverStripeNavigatorItem_StageLink extends SilverStripeNavigatorItem
|
|||||||
|
|
||||||
public function canView($member = null)
|
public function canView($member = null)
|
||||||
{
|
{
|
||||||
|
/** @var Versioned|DataObject $record */
|
||||||
|
$record = $this->record;
|
||||||
return (
|
return (
|
||||||
$this->record->hasExtension(Versioned::class)
|
$record->hasExtension(Versioned::class)
|
||||||
|
&& $record->hasStages()
|
||||||
&& $this->getDraftPage()
|
&& $this->getDraftPage()
|
||||||
// Don't follow redirects in preview, they break the CMS editing form
|
// Don't follow redirects in preview, they break the CMS editing form
|
||||||
&& !($this->record instanceof RedirectorPage)
|
&& !($record instanceof RedirectorPage)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ en:
|
|||||||
ROLLEDBACKPUBv2: 'Rolled back to published version.'
|
ROLLEDBACKPUBv2: 'Rolled back to published version.'
|
||||||
ROLLEDBACKVERSIONv2: 'Rolled back to version #{version}.'
|
ROLLEDBACKVERSIONv2: 'Rolled back to version #{version}.'
|
||||||
SAVED: 'Saved ''{title}'' successfully.'
|
SAVED: 'Saved ''{title}'' successfully.'
|
||||||
SAVEDRAFT: 'Save'
|
SAVEDRAFT: Save
|
||||||
SHOW_AS_LIST: 'show as list'
|
SHOW_AS_LIST: 'show as list'
|
||||||
TOO_MANY_PAGES: 'Too many pages'
|
TOO_MANY_PAGES: 'Too many pages'
|
||||||
TabContent: Content
|
TabContent: Content
|
||||||
@ -180,7 +180,7 @@ en:
|
|||||||
BUTTONDELETEDESC: 'Remove from draft/live and send to archive'
|
BUTTONDELETEDESC: 'Remove from draft/live and send to archive'
|
||||||
BUTTONPUBLISHED: Published
|
BUTTONPUBLISHED: Published
|
||||||
BUTTONSAVED: Saved
|
BUTTONSAVED: Saved
|
||||||
BUTTONSAVEPUBLISH: 'Publish'
|
BUTTONSAVEPUBLISH: Publish
|
||||||
BUTTONUNPUBLISH: Unpublish
|
BUTTONUNPUBLISH: Unpublish
|
||||||
BUTTONUNPUBLISHDESC: 'Remove this page from the published site'
|
BUTTONUNPUBLISHDESC: 'Remove this page from the published site'
|
||||||
Comments: Comments
|
Comments: Comments
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace SilverStripe\CMS\Tests\Controllers;
|
namespace SilverStripe\CMS\Tests\Controllers;
|
||||||
|
|
||||||
|
use Page;
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\Versioned\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\CMS\Controllers\CMSSiteTreeFilter_Search;
|
use SilverStripe\CMS\Controllers\CMSSiteTreeFilter_Search;
|
||||||
@ -65,14 +66,17 @@ class CMSSiteTreeFilterTest extends SapphireTest
|
|||||||
|
|
||||||
public function testChangedPagesFilter()
|
public function testChangedPagesFilter()
|
||||||
{
|
{
|
||||||
|
/** @var Page $unchangedPage */
|
||||||
$unchangedPage = $this->objFromFixture('Page', 'page1');
|
$unchangedPage = $this->objFromFixture('Page', 'page1');
|
||||||
$unchangedPage->publishRecursive();
|
$unchangedPage->publishRecursive();
|
||||||
|
|
||||||
|
/** @var Page $changedPage */
|
||||||
$changedPage = $this->objFromFixture('Page', 'page2');
|
$changedPage = $this->objFromFixture('Page', 'page2');
|
||||||
$changedPage->Title = 'Original';
|
$changedPage->Title = 'Original';
|
||||||
$changedPage->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
|
$changedPage->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
|
||||||
$changedPage->Title = 'Changed';
|
$changedPage->Title = 'Changed';
|
||||||
$changedPage->write();
|
$changedPage->write();
|
||||||
|
$changedPageVersion = $changedPage->Version;
|
||||||
|
|
||||||
// Check that only changed pages are returned
|
// Check that only changed pages are returned
|
||||||
$f = new CMSSiteTreeFilter_ChangedPages(array('Term' => 'Changed'));
|
$f = new CMSSiteTreeFilter_ChangedPages(array('Term' => 'Changed'));
|
||||||
@ -93,8 +97,9 @@ class CMSSiteTreeFilterTest extends SapphireTest
|
|||||||
|
|
||||||
// If we roll back to an earlier version than what's on the published site, we should still show the changed
|
// If we roll back to an earlier version than what's on the published site, we should still show the changed
|
||||||
$changedPage->Title = 'Changed 2';
|
$changedPage->Title = 'Changed 2';
|
||||||
|
$changedPage->write();
|
||||||
$changedPage->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
|
$changedPage->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
|
||||||
$changedPage->doRollbackTo(1);
|
$changedPage->doRollbackTo($changedPageVersion);
|
||||||
|
|
||||||
$f = new CMSSiteTreeFilter_ChangedPages(array('Term' => 'Changed'));
|
$f = new CMSSiteTreeFilter_ChangedPages(array('Term' => 'Changed'));
|
||||||
$results = $f->pagesIncluded();
|
$results = $f->pagesIncluded();
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
namespace SilverStripe\CMS\Tests\Controllers;
|
namespace SilverStripe\CMS\Tests\Controllers;
|
||||||
|
|
||||||
use SilverStripe\CMS\Controllers\SilverStripeNavigator;
|
use SilverStripe\CMS\Controllers\SilverStripeNavigator;
|
||||||
|
use SilverStripe\CMS\Controllers\SilverStripeNavigatorItem_ArchiveLink;
|
||||||
|
use SilverStripe\CMS\Controllers\SilverStripeNavigatorItem_LiveLink;
|
||||||
use SilverStripe\CMS\Controllers\SilverStripeNavigatorItem_StageLink;
|
use SilverStripe\CMS\Controllers\SilverStripeNavigatorItem_StageLink;
|
||||||
use SilverStripe\Dev\SapphireTest;
|
use SilverStripe\Dev\SapphireTest;
|
||||||
use SilverStripe\Security\Member;
|
use SilverStripe\Security\Member;
|
||||||
@ -11,6 +13,10 @@ class SilverStripeNavigatorTest extends SapphireTest
|
|||||||
{
|
{
|
||||||
protected static $fixture_file = 'CMSMainTest.yml';
|
protected static $fixture_file = 'CMSMainTest.yml';
|
||||||
|
|
||||||
|
protected static $extra_dataobjects = [
|
||||||
|
SilverStripeNavigatorTest\UnstagedRecord::class,
|
||||||
|
];
|
||||||
|
|
||||||
public function testGetItems()
|
public function testGetItems()
|
||||||
{
|
{
|
||||||
$page = $this->objFromFixture('Page', 'page1');
|
$page = $this->objFromFixture('Page', 'page1');
|
||||||
@ -29,6 +35,8 @@ class SilverStripeNavigatorTest extends SapphireTest
|
|||||||
$classes,
|
$classes,
|
||||||
'Autodiscovers new classes'
|
'Autodiscovers new classes'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Non-versioned items don't have stage / live
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCanView()
|
public function testCanView()
|
||||||
@ -47,5 +55,13 @@ class SilverStripeNavigatorTest extends SapphireTest
|
|||||||
$items = $navigator->getItems();
|
$items = $navigator->getItems();
|
||||||
$classes = array_map('get_class', $items->toArray());
|
$classes = array_map('get_class', $items->toArray());
|
||||||
$this->assertContains(SilverStripeNavigatorTest_ProtectedTestItem::class, $classes);
|
$this->assertContains(SilverStripeNavigatorTest_ProtectedTestItem::class, $classes);
|
||||||
|
|
||||||
|
// Unversioned record shouldn't be viewable in stage / live specific views
|
||||||
|
$unversioned = new SilverStripeNavigatorTest\UnstagedRecord();
|
||||||
|
$navigator2 = new SilverStripeNavigator($unversioned);
|
||||||
|
$classes = array_map('get_class', $navigator2->getItems()->toArray());
|
||||||
|
$this->assertNotContains(SilverStripeNavigatorItem_LiveLink::class, $classes);
|
||||||
|
$this->assertNotContains(SilverStripeNavigatorItem_StageLink::class, $classes);
|
||||||
|
$this->assertNotContains(SilverStripeNavigatorItem_ArchiveLink::class, $classes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace SilverStripe\CMS\Tests\Controllers\SilverStripeNavigatorTest;
|
||||||
|
|
||||||
|
use SilverStripe\Dev\TestOnly;
|
||||||
|
use SilverStripe\ORM\CMSPreviewable;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
use SilverStripe\Versioned\Versioned;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Versioned but not staged
|
||||||
|
*/
|
||||||
|
class UnstagedRecord extends DataObject implements TestOnly, CMSPreviewable
|
||||||
|
{
|
||||||
|
private static $table_name = 'SilverStripeNavigatorTest_UnversionedRecord';
|
||||||
|
|
||||||
|
private static $extensions = [
|
||||||
|
Versioned::class . '.versioned',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function PreviewLink($action = null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To determine preview mechanism (e.g. embedded / iframe)
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getMimeType()
|
||||||
|
{
|
||||||
|
return 'text/html';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function CMSEditLink()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user