mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
removed dropDatalessFields() - needs serious refactoring before going into core again
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@48102 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
3e9c02e183
commit
a86a35f76a
@ -193,39 +193,6 @@ class CompositeField extends FormField {
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a readonly version of this field. Keeps the composition but returns readonly
|
|
||||||
* versions of all the children
|
|
||||||
*/
|
|
||||||
public function dropDatalessField() {
|
|
||||||
$newChildren = new FieldSet();
|
|
||||||
|
|
||||||
foreach($this->children as $idx => $child) {
|
|
||||||
|
|
||||||
if(is_object($child)){
|
|
||||||
if(get_class($child)=='HeaderField'||get_class($child)=='LabelField'||get_class($child)=='TableListField'||is_subclass_of($child, 'TableListField')||get_class($field)=='SelectionGroup'||is_subclass_of($field, 'SelectionGroup')){
|
|
||||||
$newChildren->push($child, $idx);
|
|
||||||
}elseif($child->isComposite()){
|
|
||||||
$newChildren->push($child->dropDatalessField());
|
|
||||||
}elseif((get_class($child)!='DatalessField'&&!is_subclass_of($child, 'DatalessField'))){
|
|
||||||
if($this->hasClass('Undropable')||$child->Value()!==NULL){
|
|
||||||
$newChildren->push($child, $idx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}elseif(is_array($child)){
|
|
||||||
foreach($child as $idx=>$subChild){
|
|
||||||
if(is_object($subChild)){
|
|
||||||
if($subChild->isComposite){
|
|
||||||
$newChildren->push($subChild->dropDatalessField());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$this->children = $newChildren;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
function IsReadonly() {
|
function IsReadonly() {
|
||||||
return $this->readonly;
|
return $this->readonly;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user