ENHANCEMENT: more robust conditional check before we go to foreach loop, more robust conditional checking before we call a FormField function where we are not sure the caller is a FormField object.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@73435 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Normann Lou 2009-03-20 01:34:12 +00:00 committed by Sam Minnee
parent bb4fe5299d
commit 3973a6a47e

View File

@ -32,8 +32,12 @@ class FieldSet extends DataObjectSet {
$itemsArr = (!is_array($items) || count(func_get_args()) > 1) ? func_get_args() : $items;
parent::__construct($itemsArr);
foreach($this->items as $item) {
$item->setContainerFieldSet($this);
if(isset($this->items)&&count($this->items)){
foreach($this->items as $item) {
if(isset($item)&&is_a($item,"FormField")){
$item->setContainerFieldSet($this);
}
}
}
}