Skip to content

Commit

Permalink
API CHANGE Removed $controller context from SiteTree->CMSTreeClasses(…
Browse files Browse the repository at this point in the history
…), now handled through closures in the specific LeftAndMain usage instead (to handle separate contexts for links and determining "current page")
  • Loading branch information
chillu committed Apr 17, 2012
1 parent 75da9fd commit 0f7dd79
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
10 changes: 9 additions & 1 deletion code/controllers/CMSPagesController.php
Expand Up @@ -10,12 +10,20 @@ class CMSPagesController extends CMSMain {
static $url_priority = 40;
static $menu_title = 'Pages';
static $required_permission_codes = 'CMS_ACCESS_CMSMain';

function PreviewLink() {
return false;
}

/**
* Doesn't deal with a single record, and we need
* to avoid session state from previous record edits leaking in here.
*/
public function currentPageID() {
return false;
}

public function isCurrentPage(DataObject $record) {
return false;
}
}
7 changes: 1 addition & 6 deletions code/model/SiteTree.php
Expand Up @@ -2531,21 +2531,16 @@ public function Level($level) {
/**
* Return the CSS classes to apply to this node in the CMS tree
*
* @param Controller $controller The controller object that the tree
* appears on
* @return string
*/
function CMSTreeClasses($controller) {
function CMSTreeClasses() {
$classes = sprintf('class-%s', $this->class);
if($this->HasBrokenFile || $this->HasBrokenLink)
$classes .= " BrokenLink";

if(!$this->canAddChildren())
$classes .= " nochildren";

if($controller->isCurrentPage($this))
$classes .= " current";

if(!$this->canEdit() && !$this->canAddChildren())
$classes .= " disabled";

Expand Down
4 changes: 2 additions & 2 deletions code/model/VirtualPage.php
Expand Up @@ -348,8 +348,8 @@ function updateImageTracking() {
$this->ImageTracking()->setByIdList($this->CopyContentFrom()->ImageTracking()->column('ID'));
}

function CMSTreeClasses($controller) {
return parent::CMSTreeClasses($controller) . ' VirtualPage-' . $this->CopyContentFrom()->ClassName;
function CMSTreeClasses() {
return parent::CMSTreeClasses() . ' VirtualPage-' . $this->CopyContentFrom()->ClassName;
}

/**
Expand Down

0 comments on commit 0f7dd79

Please sign in to comment.