src/Forms/Resources/Transformers/ChoiceFieldTransformer.php
protected function parseChoices(array $choices)
    {
        $items = [];

        foreach ($choices as $key => $value) {
            if (is_array($value)) {
                // Handle options groups data.
                $items[] = ['key' => $key, 'value' => '', 'type' => 'group'];
                $items = array_merge($items, $this->parseChoices($value));
            } else {
                $items[] = ['key' => $key, 'value' => $value, 'type' => 'option'];
            }
        }

        return $items;
    }
protected function parseChoices(array $choices)
    {
        $items = [];

        foreach ($choices as $key => $value) {
            if (is_array($value)) {
                // Handle options groups data.
                $items[] = ['key' => $key, 'value' => '', 'type' => 'group'];
                $items = array_merge($items, $this->parseChoices($value));
            } else {
                $items[] = ['key' => $key, 'value' => $value, 'type' => 'option'];
            }
        }

        return $items;
    }
protected function parseChoices ( array $ choices ) { $ items = [ ] ; foreach ( $ choices as $ key => $ value ) { if ( is_array ( $ value ) ) { // Handle options groups data. $ items [ ] = [ 'key' => $ key , 'value' => '' , 'type' => 'group' ] ; $ items = array_merge ( $ items , $ this -> parseChoices ( $ value ) ) ; } else { $ items [ ] = [ 'key' => $ key , 'value' => $ value , 'type' => 'option' ] ; } } return $ items ; }
Parse field choices.

@param array $choices

@return array
Parse field choices .