From c8ac8a274d1bdcd01fdf70fe589a9d3b7db89029 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 25 May 2010 04:26:47 +0000 Subject: [PATCH] BUGFIX #5099 FileIFrameField fails when using it with a locale different to the default (from r100747) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@105634 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- forms/FileIFrameField.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/forms/FileIFrameField.php b/forms/FileIFrameField.php index 1e0043fd2..35a767edf 100755 --- a/forms/FileIFrameField.php +++ b/forms/FileIFrameField.php @@ -63,6 +63,7 @@ class FileIFrameField extends FileField { }else{ $iframe = "iframe"; } + return $this->createTag ( 'iframe', array ( @@ -135,15 +136,22 @@ class FileIFrameField extends FileField { } $fileSources["existing//$selectFile"] = new TreeDropdownField('ExistingFile', '', 'File'); + + $fields = new FieldSet ( + new HeaderField('EditFileHeader', $title), + new SelectionGroup('FileSource', $fileSources) + ); + + // locale needs to be passed through from the iframe source + if(isset($_GET['locale'])) { + $fields->push(new HiddenField('locale', '', $_GET['locale'])); + } return new Form ( $this, 'EditFileForm', - new FieldSet ( - new HeaderField('EditFileHeader', $title), - new SelectionGroup('FileSource', $fileSources) - ), - new FieldSet ( + $fields, + new FieldSet( new FormAction('save', $title) ) );