private static function handleObjectOrArrayValues($formData, $translatable, $languages = [])
    {
        if($formData['type']['inputType'] == 'db') {
            $tmpArr = [];
            $primaryKey = "";
            if($formData['dbTable']['belongsTo'] == 'User') {
                $primaryKey = "userID";
            }else if($formData['dbTable']['belongsTo'] == 'PostType') {
                $primaryKey = "postID";
            }

            if($translatable) {
                if(is_array($formData['value']) && !count($formData['value'])) {
                    foreach ($languages as $language){
                        $tmpArr[$language['slug']] = "";
                    }
                    return json_encode($tmpArr);
                }

                if($formData['value'] != "") {
                    foreach ($formData['value'] as $langSlug => $valuesByLang){
                        if($valuesByLang == "") {
                            $tmpArr[$langSlug] = "";
                            continue;
                        }
                        if($formData['isMultiple']) {
                            $c = 0;
                            foreach ($valuesByLang as $singleValue){
                                if(isset($singleValue[$primaryKey])) {
                                    $tmpArr[$langSlug][] = $singleValue[$primaryKey];
                                    $c++;
                                }
                            }
                        }else{
                            if(isset($valuesByLang[$primaryKey])) {
                                $tmpArr[$langSlug] = $valuesByLang[$primaryKey];
                            }
                        }
                    }
                }
            }else{

                if($formData['isMultiple']) {
                    $c = 0;
                    foreach ($formData['value'] as $singleValue){
                        if(isset($singleValue[$primaryKey])) {
                            $tmpArr[] = $singleValue[$primaryKey];
                            $c++;
                        }
                    }
                }else{
                    if(isset($formData['value'][$primaryKey])) {
                        $tmpArr = $formData['value'][$primaryKey];
                    }
                }
            }

            return json_encode($tmpArr);
        }else{
            if($translatable) {
                return json_encode($formData['value']);
            }else{
                return implode(",", $formData['value']);
            }
        }
    }
private static function handleObjectOrArrayValues($formData, $translatable, $languages = [])
    {
        if($formData['type']['inputType'] == 'db') {
            $tmpArr = [];
            $primaryKey = "";
            if($formData['dbTable']['belongsTo'] == 'User') {
                $primaryKey = "userID";
            }else if($formData['dbTable']['belongsTo'] == 'PostType') {
                $primaryKey = "postID";
            }

            if($translatable) {
                if(is_array($formData['value']) && !count($formData['value'])) {
                    foreach ($languages as $language){
                        $tmpArr[$language['slug']] = "";
                    }
                    return json_encode($tmpArr);
                }

                if($formData['value'] != "") {
                    foreach ($formData['value'] as $langSlug => $valuesByLang){
                        if($valuesByLang == "") {
                            $tmpArr[$langSlug] = "";
                            continue;
                        }
                        if($formData['isMultiple']) {
                            $c = 0;
                            foreach ($valuesByLang as $singleValue){
                                if(isset($singleValue[$primaryKey])) {
                                    $tmpArr[$langSlug][] = $singleValue[$primaryKey];
                                    $c++;
                                }
                            }
                        }else{
                            if(isset($valuesByLang[$primaryKey])) {
                                $tmpArr[$langSlug] = $valuesByLang[$primaryKey];
                            }
                        }
                    }
                }
            }else{

                if($formData['isMultiple']) {
                    $c = 0;
                    foreach ($formData['value'] as $singleValue){
                        if(isset($singleValue[$primaryKey])) {
                            $tmpArr[] = $singleValue[$primaryKey];
                            $c++;
                        }
                    }
                }else{
                    if(isset($formData['value'][$primaryKey])) {
                        $tmpArr = $formData['value'][$primaryKey];
                    }
                }
            }

            return json_encode($tmpArr);
        }else{
            if($translatable) {
                return json_encode($formData['value']);
            }else{
                return implode(",", $formData['value']);
            }
        }
    }
private static function handleObjectOrArrayValues ( $ formData , $ translatable , $ languages = [ ] ) { if ( $ formData [ 'type' ] [ 'inputType' ] == 'db' ) { $ tmpArr = [ ] ; $ primaryKey = "" ; if ( $ formData [ 'dbTable' ] [ 'belongsTo' ] == 'User' ) { $ primaryKey = "userID" ; } else if ( $ formData [ 'dbTable' ] [ 'belongsTo' ] == 'PostType' ) { $ primaryKey = "postID" ; } if ( $ translatable ) { if ( is_array ( $ formData [ 'value' ] ) && ! count ( $ formData [ 'value' ] ) ) { foreach ( $ languages as $ language ) { $ tmpArr [ $ language [ 'slug' ] ] = "" ; } return json_encode ( $ tmpArr ) ; } if ( $ formData [ 'value' ] != "" ) { foreach ( $ formData [ 'value' ] as $ langSlug => $ valuesByLang ) { if ( $ valuesByLang == "" ) { $ tmpArr [ $ langSlug ] = "" ; continue ; } if ( $ formData [ 'isMultiple' ] ) { $ c = 0 ; foreach ( $ valuesByLang as $ singleValue ) { if ( isset ( $ singleValue [ $ primaryKey ] ) ) { $ tmpArr [ $ langSlug ] [ ] = $ singleValue [ $ primaryKey ] ; $ c ++ ; } } } else { if ( isset ( $ valuesByLang [ $ primaryKey ] ) ) { $ tmpArr [ $ langSlug ] = $ valuesByLang [ $ primaryKey ] ; } } } } } else { if ( $ formData [ 'isMultiple' ] ) { $ c = 0 ; foreach ( $ formData [ 'value' ] as $ singleValue ) { if ( isset ( $ singleValue [ $ primaryKey ] ) ) { $ tmpArr [ ] = $ singleValue [ $ primaryKey ] ; $ c ++ ; } } } else { if ( isset ( $ formData [ 'value' ] [ $ primaryKey ] ) ) { $ tmpArr = $ formData [ 'value' ] [ $ primaryKey ] ; } } } return json_encode ( $ tmpArr ) ; } else { if ( $ translatable ) { return json_encode ( $ formData [ 'value' ] ) ; } else { return implode ( "," , $ formData [ 'value' ] ) ; } } }
Handles post type field values.

@param  array   $formData     data of a custom field
@param  boolean $translatable if this field is translatable
@param  array   $languages    list of languages data
@return string encoded value of a custom field
Handles post type field values .