mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX a VirtualPage will now use the correct template
BUGFIX a VirtualPage can now access the custom fields of its parent git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@82591 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
d5d8cf15f6
commit
012427d6c8
@ -121,6 +121,25 @@ class VirtualPage extends Page {
|
|||||||
$this->$virtualField = $source->$virtualField;
|
$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;
|
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
|
* When the virtualpage is loaded, check to see if the versions are the same
|
||||||
* if not, reload the content.
|
* if not, reload the content.
|
||||||
|
Loading…
Reference in New Issue
Block a user