children as $child) { if ( $child instanceof Section ) { $sections[] = $child; $currentAnonymousSection = null; } else { //Put all non-section elements into an anonymous section. if ( $currentAnonymousSection === null ) { $currentAnonymousSection = new Section(''); $sections[] = $currentAnonymousSection; } $currentAnonymousSection->add($child); } } return $sections; } protected function getJsUiElementType() { return 'structure'; } }