diff --git a/core/model/VirtualPage.php b/core/model/VirtualPage.php index 8ffb769e1..cd2561ea7 100755 --- a/core/model/VirtualPage.php +++ b/core/model/VirtualPage.php @@ -121,6 +121,25 @@ class VirtualPage extends Page { $this->$virtualField = $source->$virtualField; } } + + /** + * Allow attributes on the master page to pass + * through to the virtual page + * + * @param string $field + * @return mixed + */ + function __get($field) { + $return = parent::__get($field); + if ($return === null) { + if($this->copyContentFrom()->hasMethod($funcName = "get$field")) { + $return = $this->copyContentFrom()->$funcName(); + } else if($this->copyContentFrom()->hasField($field)) { + $return = $this->copyContentFrom()->getField($field); + } + } + return $return; + } } /** @@ -142,6 +161,12 @@ class VirtualPage_Controller extends Page_Controller { return; } + function getViewer($action) { + $name = get_class($this->CopyContentFrom())."_Controller"; + $controller = new $name(); + return $controller->getViewer($action); + } + /** * When the virtualpage is loaded, check to see if the versions are the same * if not, reload the content.