src/Forms/GroupedDropdownField.php
protected function getFieldOption($valueOrGroup, $titleOrOptions)
    {
        // Return flat option
        if (!is_array($titleOrOptions)) {
            return parent::getFieldOption($valueOrGroup, $titleOrOptions);
        }

        // Build children from options list
        $options = new ArrayList();
        foreach ($titleOrOptions as $childValue => $childTitle) {
            $options->push($this->getFieldOption($childValue, $childTitle));
        }

        return new ArrayData(array(
            'Title' => $valueOrGroup,
            'Options' => $options
        ));
    }
protected function getFieldOption($valueOrGroup, $titleOrOptions)
    {
        // Return flat option
        if (!is_array($titleOrOptions)) {
            return parent::getFieldOption($valueOrGroup, $titleOrOptions);
        }

        // Build children from options list
        $options = new ArrayList();
        foreach ($titleOrOptions as $childValue => $childTitle) {
            $options->push($this->getFieldOption($childValue, $childTitle));
        }

        return new ArrayData(array(
            'Title' => $valueOrGroup,
            'Options' => $options
        ));
    }
protected function getFieldOption ( $ valueOrGroup , $ titleOrOptions ) { // Return flat option if ( ! is_array ( $ titleOrOptions ) ) { return parent :: getFieldOption ( $ valueOrGroup , $ titleOrOptions ) ; } // Build children from options list $ options = new ArrayList ( ) ; foreach ( $ titleOrOptions as $ childValue => $ childTitle ) { $ options -> push ( $ this -> getFieldOption ( $ childValue , $ childTitle ) ) ; } return new ArrayData ( array ( 'Title' => $ valueOrGroup , 'Options' => $ options ) ) ; }
Build a potentially nested fieldgroup

@param mixed $valueOrGroup Value of item, or title of group
@param string|array $titleOrOptions Title of item, or options in grouip
@return ArrayData Data for this item
Build a potentially nested fieldgroup