Jump to:

7940 Posts in 1543 Topics by 946 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » IDOM + uploadify: can't add existing files

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: 436 Views
  • max5k
    Community Member
    8 Posts

    IDOM + uploadify: can't add existing files Link to this post

    Hello everyone,

    i have a Pagetype "SlideshowPage" where multiple Images should be added.

    Therefor i have a Class "SlideshowImage extends Image"
    which has_one "SlideshowPage"
    SlideshowPage $has_many "SlideshowImages" => "SlideshowImage".

    On the Page i have a IDOM:

    $manager = new ImageDataObjectManager($this, 'SlideshowImages', 'SlideshowImage');
    $fields->addFieldToTab('Root.Content.Main', $manager, 'Content');

    Everything is working beautifully so far.
    As long as i upload images directly from the SlideshowPage.

    Now the Problem:

    It seems to be impossible to add images previously uploaded via the Assetadmin.
    (can see, them select them, continue but images are not attached. no ajax reponse erros, though)

    Seems to me that this is because previously uploaded images have the ClassName "Image"
    and Images uploaded via the IDOM are generated as "SlideshowImages"

    Because when i change the className (of images added via AssetAdmin) manually in the "File" table, ("Image" to "SlideshowImage")
    i can actually add them on the SlideshowPage via IDOM.

    Is there any way to configure IDOM to add existing "Images" as "SlideshowImages" ?

    Any help would be much appreciated!



  • max5k
    Community Member
    8 Posts

    Re: IDOM + uploadify: can't add existing files Link to this post


    here's the (kind of obvious) solution:

    my custom image:

    Class SlideshowImage extends DataObject{
    $has_one = atrray( 'Image', 'Image');

    my page holding the custom images

    new ImageDataObjectManager($this, 'Images', 'LdGalleryImage', 'Image')

    i think it's a bit tricky to understand not to extend Image directly (as Images extends File which extends DataObject)

    but it's all already explained here: http://www.silverstripe.org/dataobjectmanager-module-forum/show/14593

    so thanks !

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.