mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Add an element sets the relation with the parent automatically but this functionnality needs to be unset for the HasManyComplexTablefield (merged from branches 2.2.0, r45135)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@46094 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
5f468b4902
commit
dd85ba1141
@ -77,6 +77,8 @@ class ComplexTableField extends TableListField {
|
||||
*/
|
||||
protected $detailFormValidator = null;
|
||||
|
||||
protected $relationAutoSetting = true;
|
||||
|
||||
/**
|
||||
* See class comments
|
||||
*
|
||||
@ -102,6 +104,7 @@ class ComplexTableField extends TableListField {
|
||||
Requirements::css("sapphire/css/ComplexTableField.css");
|
||||
|
||||
parent::__construct($name, $sourceClass, $fieldList, $sourceFilter, $sourceSort, $sourceJoin);
|
||||
|
||||
}
|
||||
|
||||
function isComposite() {
|
||||
@ -258,6 +261,7 @@ JS;
|
||||
}
|
||||
// add relational fields
|
||||
$detailFields->push(new HiddenField("ctf[parentClass]"," ",$this->getParentClass()));
|
||||
if( $this->relationAutoSetting )
|
||||
$detailFields->push(new HiddenField("$parentIdName"," ",$ID));
|
||||
}
|
||||
|
||||
@ -563,7 +567,7 @@ JS;
|
||||
* Returns the db-fieldname of the currently used has_one-relationship.
|
||||
*/
|
||||
function getParentIdName( $parentClass, $childClass ) {
|
||||
return $this->getParentIdNameRelation( $parentClass, $childClass, 'has_one' );
|
||||
return $this->getParentIdNameRelation( $childClass, $parentClass, 'has_one' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user