Skip to content

Commit

Permalink
If Translatable is active, set the Locale for new records (see silver…
Browse files Browse the repository at this point in the history
…stripe#32 for more info)
  • Loading branch information
JorisDebonnet committed Mar 11, 2016
1 parent aa2e671 commit 1fec7b2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions code/forms/gridfield/GridFieldSiteTreeAddNewButton.php
Expand Up @@ -120,6 +120,12 @@ public function handleAction(GridField $gridField, $actionName, $arguments, $dat
"PageType" => $tmpData['pageType']
);

// If Translatable is active, set the Locale (this will no longer be needed in a future Translatable patch;
// see https://github.com/silverstripe/silverstripe-lumberjack/pull/32 for more info)
if(singleton('SiteTree')->hasExtension('Translatable')) {
$data['Locale'] = Translatable::get_current_locale();
}

$controller = Injector::inst()->create("CMSPageAddController");

$form = $controller->AddForm();
Expand Down

0 comments on commit 1fec7b2

Please sign in to comment.