Utility/Entity.php
private function initGroup($group, $default = null)
    {
        $groupId = $group->id;
        $groupName = $group->name;
        $fields = $group->getListFields();

        $fieldData = $this->getFieldPostData($default);
        $controls = array();
        if ($fields->count()) {
            $this->fieldInDB = EntityModel::getAllDataFields($this->entityId, $this->type);

            $controls['name'] = $groupName;
            foreach ($fields as $field) {
                $fieldValue = @$fieldData['fields'][$field->id];
                $fieldControl = null;
                $dbData = $this->getFieldDataInDB($field->id, $this->locale);

                switch ($field->type) {
                    case 'text':
                        $fieldControl = new Text($field, $this->entityId, $this->locale, $dbData);
                        break;
                    case 'number':
                        $fieldControl = new Number($field, $this->entityId, $this->locale, $dbData);
                        break;
                    case 'textarea':
                        $fieldControl = new Textarea($field, $this->entityId, $this->locale, $dbData);
                        break;
                    case 'wysiwyg':
                        $fieldControl = new Wysiwyg($field, $this->entityId, $this->locale, $dbData);
                        break;
                    case 'file':
                        $fieldControl = new File($field, $this->entityId, $this->locale, $dbData);
                        break;
                    case 'image':
                        $fieldControl = new Image($field, $this->entityId, $this->locale, $dbData);
                        break;
                    case 'repeater':
                        $fieldControl = new Repeater($field, $this->entityId, $this->locale, $dbData);
                        break;
                }

                // assign entity type class to field to use for save data;
                $fieldControl->setEntityType($this->type);
                $fieldControl->init($fieldValue);
                $controls['fields'][$field->id] = $fieldControl;
                $this->fieldValues[$field->name] = $fieldControl->getDisplayValue();
            }
            $this->groupFields[$groupId] = $controls;
        }
    }
private function initGroup($group, $default = null)
    {
        $groupId = $group->id;
        $groupName = $group->name;
        $fields = $group->getListFields();

        $fieldData = $this->getFieldPostData($default);
        $controls = array();
        if ($fields->count()) {
            $this->fieldInDB = EntityModel::getAllDataFields($this->entityId, $this->type);

            $controls['name'] = $groupName;
            foreach ($fields as $field) {
                $fieldValue = @$fieldData['fields'][$field->id];
                $fieldControl = null;
                $dbData = $this->getFieldDataInDB($field->id, $this->locale);

                switch ($field->type) {
                    case 'text':
                        $fieldControl = new Text($field, $this->entityId, $this->locale, $dbData);
                        break;
                    case 'number':
                        $fieldControl = new Number($field, $this->entityId, $this->locale, $dbData);
                        break;
                    case 'textarea':
                        $fieldControl = new Textarea($field, $this->entityId, $this->locale, $dbData);
                        break;
                    case 'wysiwyg':
                        $fieldControl = new Wysiwyg($field, $this->entityId, $this->locale, $dbData);
                        break;
                    case 'file':
                        $fieldControl = new File($field, $this->entityId, $this->locale, $dbData);
                        break;
                    case 'image':
                        $fieldControl = new Image($field, $this->entityId, $this->locale, $dbData);
                        break;
                    case 'repeater':
                        $fieldControl = new Repeater($field, $this->entityId, $this->locale, $dbData);
                        break;
                }

                // assign entity type class to field to use for save data;
                $fieldControl->setEntityType($this->type);
                $fieldControl->init($fieldValue);
                $controls['fields'][$field->id] = $fieldControl;
                $this->fieldValues[$field->name] = $fieldControl->getDisplayValue();
            }
            $this->groupFields[$groupId] = $controls;
        }
    }
Initial fields of each group and assign to GroupFields array.

@param $group
@param null $default