src/Controller/DefaultController.php
protected function loadEditViewData(Resource $oItem = null): void
    {
        //  Extract the fields into fieldsets
        $aConfig    = $this->getConfig();
        $aFieldSets = array_combine(
            $aConfig['FIELDSET_ORDER'],
            array_pad(
                [],
                count($aConfig['FIELDSET_ORDER']),
                []
            )
        );

        foreach ($aConfig['FIELDS'] as $oField) {

            if (empty($oItem)) {
                if (in_array($oField->key, $aConfig['CREATE_IGNORE_FIELDS'])) {
                    continue;
                }
            } else {
                if (in_array($oField->key, $aConfig['EDIT_IGNORE_FIELDS'])) {
                    continue;
                }
            }

            $sFieldSet = getFromArray('fieldset', (array) $oField, 'Details');

            if (!array_key_exists($sFieldSet, $aFieldSets)) {
                $aFieldSets[$sFieldSet] = [];
            }

            $aFieldSets[$sFieldSet][] = $oField;
        }

        $this->data['aFieldSets'] = array_filter($aFieldSets);
        $this->data['item']       = $oItem;
    }
protected function loadEditViewData(Resource $oItem = null): void
    {
        //  Extract the fields into fieldsets
        $aConfig    = $this->getConfig();
        $aFieldSets = array_combine(
            $aConfig['FIELDSET_ORDER'],
            array_pad(
                [],
                count($aConfig['FIELDSET_ORDER']),
                []
            )
        );

        foreach ($aConfig['FIELDS'] as $oField) {

            if (empty($oItem)) {
                if (in_array($oField->key, $aConfig['CREATE_IGNORE_FIELDS'])) {
                    continue;
                }
            } else {
                if (in_array($oField->key, $aConfig['EDIT_IGNORE_FIELDS'])) {
                    continue;
                }
            }

            $sFieldSet = getFromArray('fieldset', (array) $oField, 'Details');

            if (!array_key_exists($sFieldSet, $aFieldSets)) {
                $aFieldSets[$sFieldSet] = [];
            }

            $aFieldSets[$sFieldSet][] = $oField;
        }

        $this->data['aFieldSets'] = array_filter($aFieldSets);
        $this->data['item']       = $oItem;
    }
Load data for the edit/create view

@param Resource $oItem The main item object

@return void