Options(); $options = array(); if($optionSet) { foreach( $optionSet as $option ) { $options[$option->EscapedTitle] = $option->Title; } } return new OptionsetField($this->Name, $this->Title, $options); } }