classes/item/ElementItem.php
protected function setData()
    {
        $this->initElementObject();
        if (empty($this->obElement)) {
            return;
        }

        //Set default lang (if update cache with non default lang)
        if (self::$bLangInit && !empty(self::$sDefaultLang) && $this->obElement->isClassExtendedWith('RainLab.Translate.Behaviors.TranslatableModel')) {
            $this->obElement->lang(self::$sDefaultLang);
        }

        //Get cached field list from model and add fields to cache array
        $this->setCachedFieldList();

        //Get element data
        $arResult = $this->getElementData();
        if (empty($arResult) || !is_array($arResult)) {
            $arResult = [];
        }

        //Add fields values to cached array
        foreach ($arResult as $sField => $sValue) {
            $this->setAttribute($sField, $sValue);
        }

        //Save lang properties (integration with Translate plugin)
        $this->setLangProperties();

        //Run methods from $arExtendResult array
        $this->setExtendData();
    }
protected function setData()
    {
        $this->initElementObject();
        if (empty($this->obElement)) {
            return;
        }

        //Set default lang (if update cache with non default lang)
        if (self::$bLangInit && !empty(self::$sDefaultLang) && $this->obElement->isClassExtendedWith('RainLab.Translate.Behaviors.TranslatableModel')) {
            $this->obElement->lang(self::$sDefaultLang);
        }

        //Get cached field list from model and add fields to cache array
        $this->setCachedFieldList();

        //Get element data
        $arResult = $this->getElementData();
        if (empty($arResult) || !is_array($arResult)) {
            $arResult = [];
        }

        //Add fields values to cached array
        foreach ($arResult as $sField => $sValue) {
            $this->setAttribute($sField, $sValue);
        }

        //Save lang properties (integration with Translate plugin)
        $this->setLangProperties();

        //Run methods from $arExtendResult array
        $this->setExtendData();
    }
protected function setData ( ) { $ this -> initElementObject ( ) ; if ( empty ( $ this -> obElement ) ) { return ; } //Set default lang (if update cache with non default lang) if ( self :: $ bLangInit && ! empty ( self :: $ sDefaultLang ) && $ this -> obElement -> isClassExtendedWith ( 'RainLab.Translate.Behaviors.TranslatableModel' ) ) { $ this -> obElement -> lang ( self :: $ sDefaultLang ) ; } //Get cached field list from model and add fields to cache array $ this -> setCachedFieldList ( ) ; //Get element data $ arResult = $ this -> getElementData ( ) ; if ( empty ( $ arResult ) || ! is_array ( $ arResult ) ) { $ arResult = [ ] ; } //Add fields values to cached array foreach ( $ arResult as $ sField => $ sValue ) { $ this -> setAttribute ( $ sField , $ sValue ) ; } //Save lang properties (integration with Translate plugin) $ this -> setLangProperties ( ) ; //Run methods from $arExtendResult array $ this -> setExtendData ( ) ; }
Set data from model object
Set data from model object