mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
FIX issue where empty composite fields created a fieldlist with empty items
This commit is contained in:
parent
a7588b2ac4
commit
a0f9535dd4
@ -47,13 +47,14 @@ class CompositeField extends FormField {
|
||||
if($children instanceof FieldList) {
|
||||
$this->children = $children;
|
||||
} elseif(is_array($children)) {
|
||||
$this->children = new FieldList($children);
|
||||
$this->children = new FieldList($children);
|
||||
} else {
|
||||
$children = is_array(func_get_args()) ? func_get_args() : array();
|
||||
$this->children = new FieldList($children);
|
||||
//filter out null/empty items
|
||||
$children = array_filter(func_get_args());
|
||||
$this->children = new FieldList($children);
|
||||
}
|
||||
$this->children->setContainerField($this);
|
||||
|
||||
|
||||
// Skipping FormField::__construct(), but we have to make sure this
|
||||
// doesn't count as a broken constructor
|
||||
$this->brokenOnConstruct = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user