BUGFIX: Allow opening of the detail pop-ups of a record on a ComplexTableField attached to a deleted page. (from r94593) (from r96762)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102393 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-04-12 03:16:54 +00:00
parent f8163a99eb
commit 5bcfbe6622

View File

@ -389,6 +389,21 @@ JS;
}
}
/**
* Return the record in which the CTF resides
*/
function getParentRecord() {
if($this->form && $record = $this->form->getRecord()) {
return $record;
} else {
if($this->sourceID()) {
$parentClass = DataObject::get_by_id($this->getParentClass(), $this->sourceID());
} else {
$parentClass = singleton($this->getParentClass());
}
}
}
/**
* (Optional) Setter for a correct parent-relation-class.
* Defaults to the record loaded into the surrounding form as a fallback.
@ -472,11 +487,7 @@ JS;
function getFieldsFor($childData) {
// See if our parent class has any many_many relations by this source class
if($this->getParentClass()) {
if($this->sourceID()) {
$parentClass = DataObject::get_by_id($this->getParentClass(), $this->sourceID());
} else {
$parentClass = singleton($this->getParentClass());
}
$parentClass = $this->getParentRecord();
$manyManyRelations = $parentClass->many_many();
$manyManyRelationName = null;