Jump to:

7940 Posts in 1543 Topics by 946 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » DOM and ModelAdmin example/overview?

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 972 Views
  • dizzystuff
    Avatar
    Community Member
    93 Posts

    DOM and ModelAdmin example/overview? Link to this post

    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

  • UncleCheese
    Avatar
    4085 Posts

    Re: DOM and ModelAdmin example/overview? Link to this post

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

  • zenmonkey
    Avatar
    Community Member
    528 Posts

    Re: DOM and ModelAdmin example/overview? Link to this post

    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

    972 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.