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, biapar, Willr, Ingo, swaiba, simon_w

DOM and ModelAdmin example/overview?


Reply


3 Posts   1001 Views

Avatar
dizzystuff

Community Member, 93 Posts

11 July 2010 at 10:15pm

Hey All

Does anyone have a link to, or could anyone provide, a quick example or even just an overview of how to integrate DOM with ModelAdmin?

I've looked all over the place and noticed UncleCheese mention that it's now possible, but I think I might need a kick in the right direction to get started.

Would be much appreciated :)

Cheers
Dizzy

Avatar
UncleCheese

Forum Moderator, 4094 Posts

12 July 2010 at 5:39am

What exactly isn't working for you? You should be able to add it the same way you do in CMSMain.

Avatar
zenmonkey

Community Member, 528 Posts

14 January 2011 at 7:24am

I'm aslo having trouble adding an ImageDOM to the model admin.

On my DataObject I have :

   static $has_many = array (
      "FrontWeb_Image" => "InventoryImage"
   );

...

   function getCMSFields()
{

$fields = parent::getCMSFields();

//Main Tab
      $frontWebManager = new ImageDataObjectManager(
         $this, // Controller
         'FrontWeb_Image', // Source name
         'InventoryImage', // Source class
         'Attachment', // File name on DataObject
         array(
         ), // Headings
         'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
         // Filter clause
         // Sort clause
         // Join clause
      );
      
      $fields->addFieldToTab("Root.Main", $frontWebManager);

return $fields;
}

The Image DataObject look like this

class InventoryImage extends DataObject {
   
   static $has_one = array (
      'BaciItem' => 'BaciItem',
      'Attachment' => 'File'
   );
   
   public function getCMSFields_forPopup()
   {
      return new FieldSet(
         new FileIFrameField('Attachment')
      );
   }
}


where BaciItem is the name of the First DataObject;

The ImageDOM appears on the ModelAdmin edit form, however, when I try to add an Inventory Image I have the standard dropdown for import from existing folder however when I select a folder I get another ImageDOM instead of the file list.

Perhaps some background will help. I'm trying to create an Inventory System. Each BaciItem has info related to it Description UPC etc, but it also needs to have a multiple images associated with it (back, front etc). realistically it will only ever have one of each, so I was planning on using multiple ImageDOMs, one of each image type.

Thanks