Skip to content

Commit

Permalink
Merge pull request #192 from tractorcow/pulls/fix-translatable-userfo…
Browse files Browse the repository at this point in the history
…rms-compat

BUG Fix compat with userforms/translatable
  • Loading branch information
chillu committed Jun 1, 2015
2 parents 1c76fdb + 6aefb2e commit 6731a68
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions code/model/Translatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,21 @@ class Translatable extends DataExtension implements PermissionProvider {
* or URL path prefixes like "/en/mypage".
*/
private static $enforce_global_unique_urls = true;

/**
* Exclude these fields from translation
*
* @var array
* @config
*/
private static $translate_excluded_fields = array(
'ViewerGroups',
'EditorGroups',
'CanViewType',
'CanEditType',
'NewTransLang',
'createtranslation'
);

/**
* Reset static configuration variables to their default values
Expand Down Expand Up @@ -1149,16 +1164,9 @@ protected function addTranslatableFields(&$fields) {
if(is_a($this->owner, $excludedPageType)) return;
}
}

// TODO Remove hardcoding for SiteTree properties
$excludeFields = array(
'ViewerGroups',
'EditorGroups',
'CanViewType',
'CanEditType',
'NewTransLang',
'createtranslation'
);

// Get excluded fields from translation
$excludeFields = $this->owner->config()->translate_excluded_fields;

// if a language other than default language is used, we're in "translation mode",
// hence have to modify the original fields
Expand Down

0 comments on commit 6731a68

Please sign in to comment.