Moved translatable dependency from CMS

This commit is contained in:
micmania1 2016-03-03 22:24:34 +00:00
parent 3e87a27ed4
commit d706885322

View File

@ -215,4 +215,18 @@ class TranslatableCMSMainExtension extends Extension {
return SiteTree::has_extension('Translatable'); return SiteTree::has_extension('Translatable');
} }
/**
* Injects the locale into a new page on creation.
*
* @param SiteTree $record
* @param Form $form
*/
public function updateDoAdd(SiteTree $record, Form $form) {
$data = $form->getData();
if(!isset($data['Locale'])) {
$data['Locale'] = Translatable::get_current_locale();
}
$record->Locale = $data['Locale'];
}
} }