mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
FIX Use better inheritance based logic for deciding which active tab to display in edit page
This commit is contained in:
parent
dd10aadddb
commit
fb6e6162ca
@ -351,17 +351,13 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
}
|
||||
|
||||
/**
|
||||
* Decide which is the active primary tab in a CMS edit screen
|
||||
* Return the active tab identifier for the CMS. Used by templates to decide which tab to give the active state.
|
||||
* The default value is "edit", as the primary content tab. Child controllers will override this.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getActiveTab()
|
||||
public function getTabIdentifier()
|
||||
{
|
||||
if ($this instanceof CMSPageSettingsController) {
|
||||
return 'settings';
|
||||
} elseif ($this instanceof CMSPageHistoryController) {
|
||||
return 'history';
|
||||
}
|
||||
return 'edit';
|
||||
}
|
||||
|
||||
|
@ -464,4 +464,9 @@ class CMSPageHistoryController extends CMSMain
|
||||
{
|
||||
return $this->versionID;
|
||||
}
|
||||
|
||||
public function getTabIdentifier()
|
||||
{
|
||||
return 'history';
|
||||
}
|
||||
}
|
||||
|
@ -26,4 +26,9 @@ class CMSPageSettingsController extends CMSMain
|
||||
$crumbs[0]->Title = _t('SilverStripe\\CMS\\Controllers\\CMSPagesController.MENUTITLE', 'Pages');
|
||||
return $crumbs;
|
||||
}
|
||||
|
||||
public function getTabIdentifier()
|
||||
{
|
||||
return 'settings';
|
||||
}
|
||||
}
|
||||
|
@ -10,17 +10,17 @@
|
||||
|
||||
<div class="cms-content-header-tabs cms-tabset">
|
||||
<ul class="cms-tabset-nav-primary nav nav-tabs">
|
||||
<li class="nav-item content-treeview<% if $ActiveTab == 'edit' %> ui-tabs-active<% end_if %>">
|
||||
<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') %>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item content-listview<% if $ActiveTab == 'settings' %> ui-tabs-active<% end_if %>">
|
||||
<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') %>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item content-listview<% if $ActiveTab == 'history' %> ui-tabs-active<% end_if %>">
|
||||
<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') %>
|
||||
</a>
|
||||
|
Loading…
Reference in New Issue
Block a user