src/helpers/I18n.php
public static function decode($value, $onEmptyValue = '')
    {
        $languages = Yii::$app->adminLanguage->getLanguages();
    
        // if its not already unserialized, decode it
        if (!is_array($value) && !empty($value)) {
            try {
                $value = Json::decode($value);
            } catch (InvalidParamException $e) {
                $value = [];
            }
        }
    
        // if value is empty, we create an empty array
        if (empty($value)) {
            $value = [];
        }
        
        // fall back for not transformed values
        if (!is_array($value)) {
            $value = (array) $value;
        }
    
        // add all not existing languages to the array (for example a language has been added after the database item has been created)
        foreach ($languages as $lang) {
            if (!array_key_exists($lang['short_code'], $value)) {
                $value[$lang['short_code']] = $onEmptyValue;
            } elseif (empty($value[$lang['short_code']])) {
                $value[$lang['short_code']] = $onEmptyValue;
            }
        }
    
        return $value;
    }
public static function decode($value, $onEmptyValue = '')
    {
        $languages = Yii::$app->adminLanguage->getLanguages();
    
        // if its not already unserialized, decode it
        if (!is_array($value) && !empty($value)) {
            try {
                $value = Json::decode($value);
            } catch (InvalidParamException $e) {
                $value = [];
            }
        }
    
        // if value is empty, we create an empty array
        if (empty($value)) {
            $value = [];
        }
        
        // fall back for not transformed values
        if (!is_array($value)) {
            $value = (array) $value;
        }
    
        // add all not existing languages to the array (for example a language has been added after the database item has been created)
        foreach ($languages as $lang) {
            if (!array_key_exists($lang['short_code'], $value)) {
                $value[$lang['short_code']] = $onEmptyValue;
            } elseif (empty($value[$lang['short_code']])) {
                $value[$lang['short_code']] = $onEmptyValue;
            }
        }
    
        return $value;
    }
public static function decode ( $ value , $ onEmptyValue = '' ) { $ languages = Yii :: $ app -> adminLanguage -> getLanguages ( ) ; // if its not already unserialized, decode it if ( ! is_array ( $ value ) && ! empty ( $ value ) ) { try { $ value = Json :: decode ( $ value ) ; } catch ( InvalidParamException $ e ) { $ value = [ ] ; } } // if value is empty, we create an empty array if ( empty ( $ value ) ) { $ value = [ ] ; } // fall back for not transformed values if ( ! is_array ( $ value ) ) { $ value = ( array ) $ value ; } // add all not existing languages to the array (for example a language has been added after the database item has been created) foreach ( $ languages as $ lang ) { if ( ! array_key_exists ( $ lang [ 'short_code' ] , $ value ) ) { $ value [ $ lang [ 'short_code' ] ] = $ onEmptyValue ; } elseif ( empty ( $ value [ $ lang [ 'short_code' ] ] ) ) { $ value [ $ lang [ 'short_code' ] ] = $ onEmptyValue ; } } return $ value ; }
Decode from Json to PHP

@param string|array $value The value to decode from json to php.
@param string $onEmptyValue Defines the value if the language could not be found and a value will be returns, this value will be used.
@return array Return the decoded php value.
Decode from Json to PHP