mirror of
https://github.com/silverstripe/silverstripe-translatable
synced 2024-10-22 11:05:59 +02:00
Only suffix unique URLSegment if enforce_global_unique_urls=true (#138)
This commit is contained in:
parent
69adec9455
commit
15e9037c1b
@ -1439,7 +1439,12 @@ class Translatable extends DataExtension implements PermissionProvider {
|
||||
} else {
|
||||
$urlSegment = $newTranslation->URLSegment;
|
||||
}
|
||||
|
||||
// Only make segment unique if it should be enforced
|
||||
if(Config::inst()->get('Translatable', 'enforce_global_unique_urls')) {
|
||||
$newTranslation->URLSegment = $urlSegment . '-' . i18n::convert_rfc1766($locale);
|
||||
}
|
||||
|
||||
// hacky way to set an existing translation group in onAfterWrite()
|
||||
$translationGroupID = $this->getTranslationGroup();
|
||||
$newTranslation->_TranslationGroupID = $translationGroupID ? $translationGroupID : $this->owner->ID;
|
||||
|
Loading…
Reference in New Issue
Block a user