mirror of
https://github.com/silverstripe/silverstripe-translatable
synced 2024-10-22 11:05:59 +02:00
FIXED: Allowed hidden "Locale" field to exist in the CMS form for SiteConfig (and other data objects)
This commit is contained in:
parent
9978765abc
commit
405fa7e3cf
@ -957,13 +957,13 @@ class Translatable extends DataExtension implements PermissionProvider {
|
||||
}
|
||||
|
||||
protected function addTranslatableFields(&$fields) {
|
||||
if(!class_exists('SiteTree')) return;
|
||||
// Don't apply these modifications for normal DataObjects - they rely on CMSMain logic
|
||||
if(!($this->owner instanceof SiteTree)) return;
|
||||
|
||||
// used in CMSMain->init() to set language state when reading/writing record
|
||||
// used in LeftAndMain->init() to set language state when reading/writing record
|
||||
$fields->push(new HiddenField("Locale", "Locale", $this->owner->Locale));
|
||||
|
||||
// Don't apply these modifications for normal DataObjects - they rely on CMSMain logic
|
||||
if(!class_exists('SiteTree')) return;
|
||||
if(!($this->owner instanceof SiteTree)) return;
|
||||
|
||||
// Don't allow translation of virtual pages because of data inconsistencies (see #5000)
|
||||
if(class_exists('VirtualPage')){
|
||||
$excludedPageTypes = array('VirtualPage');
|
||||
@ -1149,8 +1149,7 @@ class Translatable extends DataExtension implements PermissionProvider {
|
||||
* This function DOES populate the ID field with the newly created object ID
|
||||
* @see SiteConfig
|
||||
*/
|
||||
protected function populateSiteConfig()
|
||||
{
|
||||
protected function populateSiteConfig() {
|
||||
// This is required to prevent infinite loop during createTranslation
|
||||
// If createTranslation is called directly on SiteConfig then this function could
|
||||
// be called twice, but it will not cause harm for this to happen.
|
||||
@ -1192,8 +1191,7 @@ class Translatable extends DataExtension implements PermissionProvider {
|
||||
/**
|
||||
* Hooks into the DataObject::populateDefaults() method
|
||||
*/
|
||||
public function populateDefaults()
|
||||
{
|
||||
public function populateDefaults() {
|
||||
if (empty($this->owner->ID) && $this->owner instanceof SiteConfig)
|
||||
$this->populateSiteConfig();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user