silverstripe-cms/code/Controllers/SilverStripeNavigatorItem_CMSLink.php
Damian Mooyman a87a857a6e
Upgrade code for framework namespaces
Remove @package / @subpackage
Fix inifinite loop in VirtualPage_Controller
2016-09-07 16:29:26 +12:00

48 lines
992 B
PHP

<?php
namespace SilverStripe\CMS\Controllers;
use SilverStripe\Admin\LeftAndMain;
use SilverStripe\CMS\Model\RedirectorPage;
use SilverStripe\Control\Controller;
class SilverStripeNavigatorItem_CMSLink extends SilverStripeNavigatorItem
{
/** @config */
private static $priority = 10;
public function getHTML()
{
return sprintf(
'<a href="%s">%s</a>',
$this->record->CMSEditLink(),
_t('ContentController.CMS', 'CMS')
);
}
public function getTitle()
{
return _t('ContentController.CMS', 'CMS', 'Used in navigation. Should be a short label');
}
public function getLink()
{
return $this->record->CMSEditLink();
}
public function isActive()
{
return (Controller::curr() instanceof LeftAndMain);
}
public function canView($member = null)
{
return (
// Don't show in CMS
!(Controller::curr() instanceof LeftAndMain)
// Don't follow redirects in preview, they break the CMS editing form
&& !($this->record instanceof RedirectorPage)
);
}
}