Permalink
Browse files

extra functionality for commonly used stack and body class/id setup

  • Loading branch information...
1 parent 7eb7406 commit cf853c136fdf455592dadbd11bca90ec3ca7c37a @charlesmarshall charlesmarshall committed Jan 13, 2012
Showing with 20 additions and 0 deletions.
  1. +20 −0 lib/controller/CMSApplicationController.php
@@ -39,8 +39,28 @@ class CMSApplicationController extends WaxController{
public $cms_action = "cms_page";
+ public $body_class = "";
+ public $body_id = "";
+ public $content_object_stack = array();
+ public $top_level = false;
//default action
public function cms_page() {}
+
+ protected function cms_stack(){
+ if($this->cms_content && ($path = $this->cms_content->path_to_root())){
+ $this->body_class = "";
+ foreach($path as $obj){
+ $content_object_stack[] = $obj;
+ $css = str_replace("/", "_", trim($obj->permalink, "/"));
+ $this->body_id = $css;
+ $this->body_class = $css . " ". $this->body_class;
+ }
+ $this->content_object_stack = array_reverse($content_object_stack);
+ $this->top_level = $this->content_object_stack[0];
+ }else{
+ $this->body_class = $this->body_id = $this->controller."-".$this->action;
+ }
+ }
/**
*

0 comments on commit cf853c1

Please sign in to comment.