src/Common/Model/BaseComponent.php
protected function extractComponentSettings($aSettings, $sSlug)
    {
        $aOut = [];

        foreach ($aSettings as $oSetting) {

            //  If the object contains a `fields` property then consider this a field set and inception
            if (isset($oSetting->fields)) {

                $aOut = array_merge(
                    $aOut,
                    $this->extractComponentSettings(
                        $oSetting->fields,
                        $sSlug
                    )
                );

            } else {

                $sValue = appSetting($oSetting->key, $sSlug);
                if (is_null($sValue) && isset($oSetting->default)) {
                    $sValue = $oSetting->default;
                }
                $aOut[$oSetting->key] = $sValue;
            }
        }

        return $aOut;
    }
protected function extractComponentSettings($aSettings, $sSlug)
    {
        $aOut = [];

        foreach ($aSettings as $oSetting) {

            //  If the object contains a `fields` property then consider this a field set and inception
            if (isset($oSetting->fields)) {

                $aOut = array_merge(
                    $aOut,
                    $this->extractComponentSettings(
                        $oSetting->fields,
                        $sSlug
                    )
                );

            } else {

                $sValue = appSetting($oSetting->key, $sSlug);
                if (is_null($sValue) && isset($oSetting->default)) {
                    $sValue = $oSetting->default;
                }
                $aOut[$oSetting->key] = $sValue;
            }
        }

        return $aOut;
    }
protected function extractComponentSettings ( $ aSettings , $ sSlug ) { $ aOut = [ ] ; foreach ( $ aSettings as $ oSetting ) { //  If the object contains a `fields` property then consider this a field set and inception if ( isset ( $ oSetting -> fields ) ) { $ aOut = array_merge ( $ aOut , $ this -> extractComponentSettings ( $ oSetting -> fields , $ sSlug ) ) ; } else { $ sValue = appSetting ( $ oSetting -> key , $ sSlug ) ; if ( is_null ( $ sValue ) && isset ( $ oSetting -> default ) ) { $ sValue = $ oSetting -> default ; } $ aOut [ $ oSetting -> key ] = $ sValue ; } } return $ aOut ; }
Recursively gets all the settings from the settings array

@param  array  $aSettings The array of field sets and/or settings
@param  string $sSlug     The components's slug

@return array
Recursively gets all the settings from the settings array