Jump to:

7940 Posts in 1543 Topics by 946 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Managing two subclasses in one DOM?

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: 1488 Views
  • k0m0r
    Avatar
    Community Member
    39 Posts

    Managing two subclasses in one DOM? Link to this post

    Hi.
    Is DOM capable of managing two subclasses at once, both extending the same DataObject that is passed to DOM as a $sourceClass param?
    For example, I have a DataObject called Box with two subclasses: SwfBox and ImageBox.
    I would like to use DOM to add Boxes of both types, one containing SWF files and another one with images, to the same DataObjectSet.
    So what I need to have are two separate 'Add new' buttons, each for one subclass, and of course support for two different getCMSFields_forPopup() functions.
    Is there any way to achieve this in DOM?

  • UncleCheese
    Avatar
    4085 Posts

    Re: Managing two subclasses in one DOM? Link to this post

    Shouldn't be a problem. Is it not working?

  • k0m0r
    Avatar
    Community Member
    39 Posts

    Re: Managing two subclasses in one DOM? Link to this post

    Errr... I tried to find any docs about that and failed.
    I have a DOM field constructed like this:

    $manager = new DataObjectManager(
    $this,
    'BoxManager',
    'Box',
    array(
    "Title" => "Title",
    ),
    'getCMSFields_forPopup'
    );
    $fields->addFieldToTab('Root.Content.BoxManager', $manager);

    and two subclasses of the class 'Box': SwfBox and ImageBox.

    What do I need to change if I want to add SwfBoxes and ImageBoxes in the same instance of DOM?

  • UncleCheese
    Avatar
    4085 Posts

    Re: Managing two subclasses in one DOM? Link to this post

    Oh, no, you can't manage two classes in the same DOM. Has to be two separate instances.

  • imsas
    Avatar
    Community Member
    22 Posts

    Re: Managing two subclasses in one DOM? Link to this post

    I searching solution for this too. Maybe who have ideas how make this work easly?

  • DNA
    Avatar
    Community Member
    24 Posts
    1488 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.