mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merged revisions 47612 via svnmerge from
svn://svn.silverstripe.com/silverstripe/modules/sapphire/branches/2.2.0-mesq ........ r47612 | ischommer | 2008-01-04 19:11:57 +1300 (Fri, 04 Jan 2008) | 1 line formatting, removed saveInto() (same functionality as parent-class) ........ git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@52198 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
f4998d0b8d
commit
cb860c2f75
@ -1,12 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
|
||||||
* @package forms
|
|
||||||
* @subpackage fields-files
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A field that will upload files to a page for use within the CMS.
|
* A field that will upload files to a page for use within the CMS.
|
||||||
|
*
|
||||||
* @package forms
|
* @package forms
|
||||||
* @subpackage fields-files
|
* @subpackage fields-files
|
||||||
*/
|
*/
|
||||||
@ -32,21 +27,6 @@ class FileIFrameField extends FileField {
|
|||||||
return FormField::Field();
|
return FormField::Field();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function saveInto(DataObject $record) {
|
|
||||||
$fieldName = $this->name . 'ID';
|
|
||||||
$hasOnes = $record->has_one($this->name);
|
|
||||||
if(!$hasOnes) $hasOnes = $record->has_one($fieldName);
|
|
||||||
|
|
||||||
// assume that the file is connected via a has-one
|
|
||||||
if( !$hasOnes || !isset($_FILES[$this->name]) || !$_FILES[$this->name]['name']){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$file = new File();
|
|
||||||
$file->loadUploaded($_FILES[$this->name]);
|
|
||||||
|
|
||||||
$record->$fieldName = $file->ID;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
Loading…
x
Reference in New Issue
Block a user