Converted to PSR-2

This commit is contained in:
helpfulrobot 2015-12-18 07:15:27 +13:00
parent 4f92851547
commit f2831766e6

View File

@ -1,6 +1,7 @@
<?php
class BetterNavigator extends DataExtension {
class BetterNavigator extends DataExtension
{
/**
* Nominate developers who can access developer tools on live site
@ -22,17 +23,18 @@ class BetterNavigator extends DataExtension {
*
* @return string
*/
public function BetterNavigator() {
public function BetterNavigator()
{
$isDev = Director::isDev();
if($isDev || Permission::check('CMS_ACCESS_CMSMain') || Permission::check('VIEW_DRAFT_CONTENT')) {
if($this->owner && $this->owner->dataRecord && $this->owner->dataRecord instanceof SiteTree) {
if ($isDev || Permission::check('CMS_ACCESS_CMSMain') || Permission::check('VIEW_DRAFT_CONTENT')) {
if ($this->owner && $this->owner->dataRecord && $this->owner->dataRecord instanceof SiteTree) {
//Get SilverStripeNavigator links & stage info (CMS/Stage/Live/Archive)
$nav = array();
$navigator = new SilverStripeNavigator($this->owner->dataRecord);
$items = $navigator->getItems();
foreach($items as $item) {
foreach ($items as $item) {
$nav[$item->getName()] = array(
'Link' => $item->getLink(),
'Active' => $item->isActive()