7913 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » trying to adapt ressource example to modeladmin
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
| Go to End | ||
| Author | Topic: | 874 Views |
-
Re: trying to adapt ressource example to modeladmin

17 June 2011 at 5:51am Last edited: 17 June 2011 6:02am
Hello Uncle cheese
Sorry for the previous post
I got it almost to work.
When I create a work :
I got to tabs
Main where I can putthe 'name' and define categorie attached to the work
Files where I can upload filesWhen I add (save) the work I get to see a third tab wich seems normal according to :
new MultipleFileUploadField('UploadedFiles','Files'));
But I'm left with a problem
There is no thumbnail when I save the uploaded file
also There is nothing in the UploadedFiles tab.<?php
class Work extends DataObject {static $db = array(
'Name' => 'Varchar'
);static $has_one = array(
'Category' => 'Category'
);static $has_many = array (
'UploadedFiles' => 'WorkFile'
);static $searchable_fields = array(
'Name'
);public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Files", new MultipleFileUploadField('UploadedFiles','Files');
return $fields;
}
}I'm gonna try to find out by myself but if you have any idea
Thanks
-
Re: trying to adapt ressource example to modeladmin

21 June 2011 at 4:55am
You need to populate the dropdown with options..
$map = array();
if($result = DataObject::get("Category")) {
$map = $result->toDropdownMap();
}...
new DropdownField('CategoryID','Category',$map);
-
Re: trying to adapt ressource example to modeladmin

21 June 2011 at 5:23am
Hello
I'm getting confused ;)
Here you're talking about the categori dropdown right ?
It seems to be working now after I set up a tab to upload the files.
My problem now is that after I save the uploaded files the images seems to desapear and there is nothing under the tab uploaded file.
(in the ressource example you get to see what has been uploaded)
Maybe I'm doing something wrong or not understanding how it works
Thanks
| 874 Views | ||
| Go to Top |

