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