Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba

How to do it? New Description Field in Image Edit Section

Go to End

2 Posts   2047 Views


Community Member, 2 Posts

27 August 2014 at 9:37pm

Edited: 27/08/2014 9:37pm

That's what I want:


Forum Moderator, 5523 Posts

28 August 2014 at 9:38pm

Taking a look at UploadField (the image upload form) it looks like this form is 'EditForm'. The fields from this form are populated from UploadField::getFileEditFields() which calls getCMSFields() on the File object.

So using that understanding, modifying the getCMSFields function on the File object is easy.

1) Create an extension



class FileExtension extends DataExtension {

private static $db = array(
'ExtraField' => 'Varchar'

public function updateCMSFields(FieldList $fields) {
$fields->addFieldToTab('Root.Main', new TextField('ExtraField'));

2) Apply your extension to File

In _config.php

Object::add_extension('File', 'FileExtension');

(OR use YAML)

- FileExtension

3) Rebuild your database and visit your page with '?flush=1' to clear the cache

More documentation (