Skip to content

Commit

Permalink
If Translatable is active, set the Locale for new records
Browse files Browse the repository at this point in the history
  • Loading branch information
JorisDebonnet committed Mar 4, 2016
1 parent aa2e671 commit 58f06b5
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 (because it doesn't
// do that itself if the SiteTree record is created this way)
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 58f06b5

Please sign in to comment.