Jump to:

7939 Posts in 1543 Topics by 946 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Preview: DataObjectManager module

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
Go to End
Author Topic: 60983 Views
  • hu
    Avatar
    Community Member
    21 Posts

    Re: Preview: DataObjectManager module Link to this post

    @amir.mostofi

    Try

    ...
    public function getCMSFields()
    {
    $f = parent::getCMSFields();
    $f->addFieldToTab("Root.Content.HeaderImage", new ImageField('HeaderImage'));
    $manager = new FileDataObjectManager(
    $this, // Controller
    'ImageAttachments', // Source name
    'ImageAttachment', // Source class
    'Attachment', // File name on DataObject
    array(
    'Name' => 'Name',
    'URL' => 'URL'
    ), // Headings
    'getCMSFields_forPopup', // Detail fields (function name or FieldSet object)
    "PageID = {$this->ID}" // Filter clause
    // Sort clause
    // Join clause
    );
    $manager->setParentClass('Page');
    ...

  • drye
    Avatar
    Community Member
    49 Posts

    Re: Preview: DataObjectManager module Link to this post

    amir.mostofi,

    It may be possible you have some other issues, maybe you have bad module code? Maybe you have an error some where else. I have a production site using this exact code at http://ryedesigns.com

    Each page has their own images. No work required that is the point of the page relationship in your DataObject.

    I'm sorry I can't be of further assistance. Again, Good Luck.

  • Amir Mostofi
    Avatar
    Community Member
    59 Posts

    Re: Preview: DataObjectManager module Link to this post

    Hu, that's the code I am using now and it's not working!!!

    Drye, I'm using the latest code (r107) so I don't think it's bad module code.
    In your case, did you use FileDataObjectManager / ImageDataObjectManager on classname Page or did you subclass Page? The reason for this question is because I have FileDataObjectManager working when I subclass Page (e.g. class PartnerPage extends Page).

  • drye
    Avatar
    Community Member
    49 Posts

    Re: Preview: DataObjectManager module Link to this post

    ImageDataObjectManager, like I changed it to in pastie code. However I did subclass page. Maybe you should try this as a subclass and make sure it functions or not, to remove any suspicion.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Preview: DataObjectManager module Link to this post

    Whoa.. lots of developments since last night. Many thanks to Drye and Hu for stepping in on support.

    There's a lot to take in among all of those posts, so would someone mind posting a synopsis of what bug exists, if any, and how you resolved it? I can issue a patch today if I can get a clear idea of what's going on. Thanks.

  • hu
    Avatar
    Community Member
    21 Posts

    Re: Preview: DataObjectManager module Link to this post

    @amir.mostofi

    I did a test with your code. Everything is fine.
    I also tested the situation without ->setParentClass and empty filter. Everything is fine.

    Did you rebuild the database ?

  • vstrazz
    Avatar
    Community Member
    63 Posts

    Re: Preview: DataObjectManager module Link to this post

    Great work Uncle Cheese! I've installed the module and it's running great.

    I was wondering if there is an easy way to add export functionality to DataObjectManager since it extends ComplexTableField?

    Thanks again for quite possibly the best addition to Silverstripe thus far.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Preview: DataObjectManager module Link to this post

    I imagine it's really easy to implement. I've never used the export feature of CTF, so that's why I skipped over it. Probably just a matter of adding a button with the right action. Unless you wanted to be able export a custom view, e.g., after filting, sorting, or searching on the recordset. That would be cool!

    60983 Views
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
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.