mirror of
https://github.com/silverstripe/silverstripe-translatable
synced 2024-10-22 11:05:59 +02:00
Moved translatable dependency from CMS
This commit is contained in:
parent
3e87a27ed4
commit
d706885322
@ -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'];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user