Modified: trunk/htdocs/system/classes/theme.php (5140 => 5141)
--- trunk/htdocs/system/classes/theme.php 2011-06-13 17:37:53 UTC (rev 5140)
+++ trunk/htdocs/system/classes/theme.php 2011-06-14 13:20:39 UTC (rev 5141)
@@ -20,6 +20,7 @@
public $config_vars = array();
private $var_stack = array( array() );
private $current_var_stack = 0;
+ public $context = array();
/**
* We build the Post filters by analyzing the handler_var
@@ -647,10 +648,30 @@
$fallback = array_unique( $fallback );
$this->content = $object;
- return $this->display_fallback( $fallback, 'fetch' );
+ if(isset($context)) {
+ $this->context[] = $context;
+ }
+ $result = $this->display_fallback( $fallback, 'fetch' );
+ if(isset($context)) {
+ array_pop($this->context);
+ }
+ return $result;
}
/**
+ * Check to see if the theme is currently rendering a specific context
+ * @param string $context The context to check for.
+ * @return bool True if the context is active.
+ */
+ public function theme_has_context($theme, $context)
+ {
+ if(in_array($context, $theme->context)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
* Returns the appropriate alternate feed based on the currently matched rewrite rule.
*
* @param mixed $return Incoming return value from other plugins
@@ -1171,6 +1192,9 @@
$area_blocks = $this->get_blocks( $area, $active_scope, $theme );
$this->area = $area;
+ if(isset($context)) {
+ $this->context[] = $context;
+ }
// This is the block wrapper fallback template list
$fallback = array(
@@ -1240,7 +1264,9 @@
}
$this->area = '';
-
+ if(isset($context)) {
+ array_pop($this->context);
+ }
return $output;
}