-
-
Notifications
You must be signed in to change notification settings - Fork 10
Description
VersionControl does at the moment of its installation not store the initial values of TextareaLanguage (Textarea [Multi-language]) fields. To be specific probably all fields which store there data with the class LanguagesPageFieldValue.
I have been testing it again on the latest release version 1.2.9 by installing VersionControl on my test site and activating it for two fields on one template. The two fields are of type:
- Textarea (normal single language text)
- TextareaLanguage (multi-language)
When I check the table "version_control__data" I find only entries for the field of type "Textarea" whereas there are no entries at all for the field of type "TextareaLanguage".
As far as I can tell, there is an issue with the function used to find the data of fields of type "TextareaLanguage" at the time of installation of the module: $data->getChanges() will only return changes made to the data of the instance of $data at run-time which is the case when this code finds changes to a field of type "TextareaLanguage". But when the module is newly installed the function $data->getChanges() will return nothing since the field data is in it's original state as stored in the database table.
} else if ($data instanceof LanguagesPageFieldValue) { foreach ($data->getChanges() as $key) { if ($key == 'data') continue; $data_array[$key] = $data->getLanguageValue(str_replace('data', '', $key)); } } else {
I have done some research on how the data is stored internally at run-time and on the database and I hope that my patch addresses the problem correctly: Every language value, including the default language, is stored under a key 'data'.$language->id, the same way the function getChanges() returns the keys.
I have made a suggestion for how to changes this on my fork. There is a pull request available.