I just put something together, that might start as a beginning. What this does is create a custom getter for Content in the Page_Controller that in turn calls some general function useMaster($fieldName). This function does the following:
- check if the field is empty
- if so, check if we're using translatable
- if so, check if the current page is in fact a translation
- if all true, get the master page and return its contents
This is all very scetchy, it might lead to something better, probably need a decorator, I don't know... Curious what you make of it...
class Page_Controller extends ContentController {
...
public function Content() {
return $this->UseMaster('Content');
}
function useMaster($fieldName) {
if (empty($this->$fieldName)) {
if (Object::has_extension($this->ClassName, 'Translatable')) {
$GroupID = $this->getTranslationGroup();
if ($GroupID && $this->ID != $GroupID) {
$Master = DataObject::get_by_id('SiteTree', $GroupID);
if (!empty($Master->ID) && $Master->CanView()) {
return $Master->$fieldName;
}
}
}
}
return $this->$fieldName;
}
Martine