protected function _getFormTabGroups(array $fields = [])
    {
        $action = $this->_action();
        $groups = $action->getConfig('scaffold.form_tab_groups');

        if (empty($groups)) {
            return [];
        }

        $groupedFields = (new Collection($groups))->unfold()->toList();
        $unGroupedFields = array_diff(array_keys($fields), $groupedFields);

        if (!empty($unGroupedFields)) {
            $primayGroup = $action->getConfig('scaffold.form_primary_tab') ?: __d('crud', 'Primary');

            $groups = [$primayGroup => $unGroupedFields] + $groups;
        }

        return $groups;
    }
protected function _getFormTabGroups(array $fields = [])
    {
        $action = $this->_action();
        $groups = $action->getConfig('scaffold.form_tab_groups');

        if (empty($groups)) {
            return [];
        }

        $groupedFields = (new Collection($groups))->unfold()->toList();
        $unGroupedFields = array_diff(array_keys($fields), $groupedFields);

        if (!empty($unGroupedFields)) {
            $primayGroup = $action->getConfig('scaffold.form_primary_tab') ?: __d('crud', 'Primary');

            $groups = [$primayGroup => $unGroupedFields] + $groups;
        }

        return $groups;
    }
protected function _getFormTabGroups ( array $ fields = [ ] ) { $ action = $ this -> _action ( ) ; $ groups = $ action -> getConfig ( 'scaffold.form_tab_groups' ) ; if ( empty ( $ groups ) ) { return [ ] ; } $ groupedFields = ( new Collection ( $ groups ) ) -> unfold ( ) -> toList ( ) ; $ unGroupedFields = array_diff ( array_keys ( $ fields ) , $ groupedFields ) ; if ( ! empty ( $ unGroupedFields ) ) { $ primayGroup = $ action -> getConfig ( 'scaffold.form_primary_tab' ) ? : __d ( 'crud' , 'Primary' ) ; $ groups = [ $ primayGroup => $ unGroupedFields ] + $ groups ; } return $ groups ; }
Get field tab groups

@param array $fields Form fields.
@return array
Get field tab groups