funkjedi / acf-qtranslate

Adds qTranslate compatible fields for Text, Text Area, Wysiwyg Editor and Image.
http://wordpress.org/plugins/acf-qtranslate/
57 stars 32 forks source link

Post Object field #125

Closed asedano closed 5 years ago

asedano commented 5 years ago

Added a Post Object field type to allow choosing different posts for each language.

funkjedi commented 5 years ago

I made some changes to the implementation you'll need to be aware of if you're not using your fork and you go to update.

In your PR when updating the value it's serializing the entire value. To be consistent with the other fields I changed it to store the value using the qTranslate language tags. For example:

$value = [
  'fr' => [14, 46, 59],
  'en' => [12, 43, 56],
];

in your PR it would be stored in the database as

a:2:{s:2:"fr";a:3:{i:0;i:14;i:1;i:46;i:2;i:59;}s:2:"en";a:3:{i:0;i:12;i:1;i:43;i:2;i:56;}}

but now it's stored as

<!--:fr-->a:3:{i:0;i:14;i:1;i:46;i:2;i:59;}<!--:--><!--:en-->a:3:{i:0;i:12;i:1;i:43;i:2;i:56;}<!--:-->
asedano commented 5 years ago

Oh, thanks a lot 😊

I was in a hurry because I needed that urgently to select two different contact forms and didn't thought about that 🤦‍♂️

Enviado desde mi Android

El vie., 26 oct. 2018 5:30, Tim Robertson notifications@github.com escribió:

I made some changes to the implementation you'll need to be aware of if you're not using your fork and you go to update.

In your PR when updating the value it's serializing the entire value. To be consistent with the other fields I changed it to store the value using the qTranslate language tags. For example:

$value = [ 'fr' => [14, 46, 59], 'en' => [12, 43, 56],];

in your PR it would be stored in the database as

a:2:{s:2:"fr";a:3:{i:0;i:14;i:1;i:46;i:2;i:59;}s:2:"en";a:3:{i:0;i:12;i:1;i:43;i:2;i:56;}}

but now it's stored as

a:3:{i:0;i:14;i:1;i:46;i:2;i:59;}a:3:{i:0;i:12;i:1;i:43;i:2;i:56;}

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/funkjedi/acf-qtranslate/pull/125#issuecomment-433275078, or mute the thread https://github.com/notifications/unsubscribe-auth/AC-dF6Ia7iNdvsBArwZP8UAPO97L11spks5uooHBgaJpZM4XMjqo .