classes/item/ElementItem.php
private function getUploadFileData($obFile) : array
    {
        if (empty($obFile)) {
            return [];
        }

        //Set default lang in image object
        if (!empty(self::$sDefaultLang) && $obFile->isClassExtendedWith('RainLab.Translate.Behaviors.TranslatableModel')) {
            $obFile->lang(self::$sDefaultLang);
        }

        //Convert image data to array
        $arFileData = $obFile->toArray();
        $arLangList = $this->getActiveLangList();
        if (empty($arLangList) || !$obFile->isClassExtendedWith('RainLab.Translate.Behaviors.TranslatableModel')) {
            return $arFileData;
        }

        //Add lang fields to array
        foreach ($arLangList as $sLangCode) {
            $arFileData[$sLangCode] = [];
            foreach ($obFile->translatable as $sLangField) {
                $arFileData[$sLangCode][$sLangField] = $obFile->lang($sLangCode)->$sLangField;
            }
        }

        return $arFileData;
    }
private function getUploadFileData($obFile) : array
    {
        if (empty($obFile)) {
            return [];
        }

        //Set default lang in image object
        if (!empty(self::$sDefaultLang) && $obFile->isClassExtendedWith('RainLab.Translate.Behaviors.TranslatableModel')) {
            $obFile->lang(self::$sDefaultLang);
        }

        //Convert image data to array
        $arFileData = $obFile->toArray();
        $arLangList = $this->getActiveLangList();
        if (empty($arLangList) || !$obFile->isClassExtendedWith('RainLab.Translate.Behaviors.TranslatableModel')) {
            return $arFileData;
        }

        //Add lang fields to array
        foreach ($arLangList as $sLangCode) {
            $arFileData[$sLangCode] = [];
            foreach ($obFile->translatable as $sLangField) {
                $arFileData[$sLangCode][$sLangField] = $obFile->lang($sLangCode)->$sLangField;
            }
        }

        return $arFileData;
    }
private function getUploadFileData ( $ obFile ) : array { if ( empty ( $ obFile ) ) { return [ ] ; } //Set default lang in image object if ( ! empty ( self :: $ sDefaultLang ) && $ obFile -> isClassExtendedWith ( 'RainLab.Translate.Behaviors.TranslatableModel' ) ) { $ obFile -> lang ( self :: $ sDefaultLang ) ; } //Convert image data to array $ arFileData = $ obFile -> toArray ( ) ; $ arLangList = $ this -> getActiveLangList ( ) ; if ( empty ( $ arLangList ) || ! $ obFile -> isClassExtendedWith ( 'RainLab.Translate.Behaviors.TranslatableModel' ) ) { return $ arFileData ; } //Add lang fields to array foreach ( $ arLangList as $ sLangCode ) { $ arFileData [ $ sLangCode ] = [ ] ; foreach ( $ obFile -> translatable as $ sLangField ) { $ arFileData [ $ sLangCode ] [ $ sLangField ] = $ obFile -> lang ( $ sLangCode ) -> $ sLangField ; } } return $ arFileData ; }
Get image data from image object
@param \System\Models\File $obFile
@return []
Get image data from image object