Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 38 lines (33 sloc) 0.96 kB
<?php
/**
* A field that allows you to attach an image to a record from within a iframe - designed for use in AJAX forms where it
* is not possible to use {@link SimpleImageField}.
*
* @package forms
* @subpackage fields-files
*/
class ImageField extends FileIFrameField {
/**
* @return SimpleImageField_Disabled
*/
public function performReadonlyTransformation() {
return new SimpleImageField_Disabled($this->name, $this->title, $this->value, $this->form);
}
/**
* @return string
*/
public function FileTypeName() {
return _t('ImageField.IMAGE', 'Image');
}
/**
* Adds the filter, so the dropdown displays only images and folders.
*
* @return Form
*/
public function EditFileForm() {
$filter = create_function('$item', 'return ($item->ClassName=="Folder" || $item->ClassName=="Image");');
$form = parent::EditFileForm();
$form->dataFieldByName('ExistingFile')->setFilterFunction($filter);
return $form;
}
}
Jump to Line
Something went wrong with that request. Please try again.