That's what I want:
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
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
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
**mysite/code/FileExtension.php**
<?php
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)
File:
extensions:
- FileExtension
3) Rebuild your database and visit your page with '?flush=1' to clear the cache
More documentation (http://doc.silverstripe.org/framework/en/reference/dataextension)