mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
parent
380de0eb17
commit
9350b4a425
@ -920,18 +920,54 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
return $this->getsubtree($this->getRequest());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get "back" url for breadcrumbs
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBreadcrumbsBackLink()
|
||||
{
|
||||
$breadcrumbs = $this->Breadcrumbs();
|
||||
if ($breadcrumbs->count() < 2) {
|
||||
return $this->LinkPages();
|
||||
}
|
||||
// Get second from end breadcrumb
|
||||
return $breadcrumbs
|
||||
->offsetGet($breadcrumbs->count() - 2)
|
||||
->Link;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $unlinked
|
||||
* @return ArrayList
|
||||
*/
|
||||
public function Breadcrumbs($unlinked = false)
|
||||
{
|
||||
$items = parent::Breadcrumbs($unlinked);
|
||||
$items = new ArrayList();
|
||||
|
||||
if ($items->count() > 1) {
|
||||
// Specific to the SiteTree admin section, we never show the cms section and current
|
||||
// page in the same breadcrumbs block.
|
||||
$items->shift();
|
||||
// Check if we are editing a page
|
||||
/** @var SiteTree $record */
|
||||
$record = $this->currentPage();
|
||||
if (!$record) {
|
||||
$items->push(new ArrayData(array(
|
||||
'Title' => CMSPagesController::menu_title(),
|
||||
'Link' => ($unlinked) ? false : $this->LinkPages()
|
||||
)));
|
||||
return $items;
|
||||
}
|
||||
|
||||
// Add all ancestors
|
||||
$ancestors = $record->getAncestors();
|
||||
$ancestors = new ArrayList(array_reverse($ancestors->toArray()));
|
||||
$ancestors->push($record);
|
||||
/** @var SiteTree $ancestor */
|
||||
foreach ($ancestors as $ancestor) {
|
||||
$items->push(new ArrayData(array(
|
||||
'Title' => $ancestor->getMenuTitle(),
|
||||
'Link' => ($unlinked)
|
||||
? false
|
||||
: $ancestor->CMSEditLink()
|
||||
)));
|
||||
}
|
||||
|
||||
return $items;
|
||||
|
@ -418,13 +418,6 @@ class CMSPageHistoryController extends CMSMain
|
||||
return $form;
|
||||
}
|
||||
|
||||
public function Breadcrumbs($unlinked = false)
|
||||
{
|
||||
$crumbs = parent::Breadcrumbs($unlinked);
|
||||
$crumbs[0]->Title = _t('SilverStripe\\CMS\\Controllers\\CMSPagesController.MENUTITLE', 'Pages');
|
||||
return $crumbs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace all data fields with HTML readonly fields to display diff
|
||||
*
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
namespace SilverStripe\CMS\Controllers;
|
||||
|
||||
use SilverStripe\View\ArrayData;
|
||||
|
||||
class CMSPageSettingsController extends CMSMain
|
||||
{
|
||||
|
||||
@ -20,13 +22,6 @@ class CMSPageSettingsController extends CMSMain
|
||||
return parent::getEditForm($id, ($record) ? $record->getSettingsFields() : null);
|
||||
}
|
||||
|
||||
public function Breadcrumbs($unlinked = false)
|
||||
{
|
||||
$crumbs = parent::Breadcrumbs($unlinked);
|
||||
$crumbs[0]->Title = _t('SilverStripe\\CMS\\Controllers\\CMSPagesController.MENUTITLE', 'Pages');
|
||||
return $crumbs;
|
||||
}
|
||||
|
||||
public function getTabIdentifier()
|
||||
{
|
||||
return 'settings';
|
||||
|
@ -5,24 +5,24 @@
|
||||
<div class="fill-height flexbox-area-grow">
|
||||
<div class="cms-content-header north">
|
||||
<div class="cms-content-header-nav fill-width">
|
||||
<a href="/admin/pages" class="btn btn-secondary btn--no-text font-icon-left-open-big hidden-lg-up toolbar__back-button"></a>
|
||||
<a href="$BreadcrumbsBackLink" class="btn btn-secondary btn--no-text font-icon-left-open-big hidden-lg-up toolbar__back-button"></a>
|
||||
<% include SilverStripe\\Admin\\CMSBreadcrumbs %>
|
||||
|
||||
<div class="cms-content-header-tabs cms-tabset">
|
||||
<ul class="cms-tabset-nav-primary nav nav-tabs">
|
||||
<li class="nav-item content-treeview<% if $TabIdentifier == 'edit' %> ui-tabs-active<% end_if %>">
|
||||
<a href="$LinkPageEdit" class="nav-link cms-panel-link" title="Form_EditForm" data-href="$LinkPageEdit">
|
||||
<%t SilverStripe\CMS\Controllers\CMSMain.TabContent 'Content' %>
|
||||
<%t SilverStripe\\CMS\\Controllers\\CMSMain.TabContent 'Content' %>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item content-listview<% if $TabIdentifier == 'settings' %> ui-tabs-active<% end_if %>">
|
||||
<a href="$LinkPageSettings" class="nav-link cms-panel-link" title="Form_EditForm" data-href="$LinkPageSettings">
|
||||
<%t SilverStripe\CMS\Controllers\CMSMain.TabSettings 'Settings' %>
|
||||
<%t SilverStripe\\CMS\\Controllers\\CMSMain.TabSettings 'Settings' %>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item content-listview<% if $TabIdentifier == 'history' %> ui-tabs-active<% end_if %>">
|
||||
<a href="$LinkPageHistory" class="nav-link cms-panel-link" title="Form_EditForm" data-href="$LinkPageHistory">
|
||||
<%t SilverStripe\CMS\Controllers\CMSMain.TabHistory 'History' %>
|
||||
<%t SilverStripe\\CMS\\Controllers\\CMSMain.TabHistory 'History' %>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
Loading…
Reference in New Issue
Block a user