Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Allow Comments in DataObjectManager

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1 2
Go to End
Author Topic: 1846 Views
  • pixelmin
    Avatar
    Community Member
    16 Posts

    Allow Comments in DataObjectManager Link to this post

    How can I allow to post comments in dataobjectmanager entries? Is it possible?

    I've looking for info about this theme and I didn't find anything.

    Thanks!

  • UncleCheese
    Avatar
    4085 Posts

    Re: Allow Comments in DataObjectManager Link to this post

    Hmm.. Well, DataObjectManager isn't a theme, it's a form field for the CMS. If you want comments on your dataobjects, just add a has_many PageComments relationship and you can handle all the logic and form handling on the front end.

  • pixelmin
    Avatar
    Community Member
    16 Posts

    Re: Allow Comments in DataObjectManager Link to this post

    Thanks so much, UncleCheese!

  • pixelmin
    Avatar
    Community Member
    16 Posts

    Re: Allow Comments in DataObjectManager Link to this post

    Hi again,

    i'm trying it but I've a doubt. How do I relate PageComment with my dataobject table (e.g. 'testimonial')?

    I've seen pagecomment is related to sitetree pages through "ParentID" field. So I've added a new field to pagecomment table: "testimonialID". Is it correct? Now I have to rewrite comment functions for my dataobject?

  • UncleCheese
    Avatar
    4085 Posts

    Re: Allow Comments in DataObjectManager Link to this post

    It's more complicated than that. It's going to take quite a bit of programming. I would avoid using PageComments all together and create your own MyDataObjectComment class. Give it a has_one with your DataObject, and give your DataObject a has_many with the Comment object.

    Then, on the front end, you'll need to build a form for each one of the objects that gets displayed that runs a script on the DataObject Holder controller to add a comment to the DataObject.

    If you're new to SS, it's probably not something you want to take on. I'm happy to code it up for you, but I don't do any pro-bono work, so it would be for a cost.

  • pixelmin
    Avatar
    Community Member
    16 Posts

    Re: Allow Comments in DataObjectManager Link to this post

    Thank you, UncleCheese.

    I've been working with SS for a week cause my boss asked me to look for a CMS to use in the studio and I really love how SS works.

    I think I'm starting to understand it and you've been really helpful cause, as I said, I've created a new field in pagecommet table for my data object ID and now I was changing all the commets code. I'll start again and I'll create my own class.

    Thanks for your offering but I'm so excited with all the SS code and I'll try to do it on my own.

    Thx again!

  • UncleCheese
    Avatar
    4085 Posts

    Re: Allow Comments in DataObjectManager Link to this post

    Sure. If you get stuck, feel free to post your code.

  • freenet
    Avatar
    Community Member
    22 Posts

    Re: Allow Comments in DataObjectManager Link to this post

    Hi

    I want to add a comment to my DataObjectManager, what I did:
    1. new class DataObjectComment extends PageComment
    2. new class DataObjectCommentInterface extends PageCommentInterface
    3. added $ has_many in DataObjectManager and $ has_one in DataObjectComment
    4. created a form to post comments

    form and adding some comments (I added a couple directly to the DB) is displayed on the page, but when you press the "add post" error message
    [User Warning] popCurrent called on ModelAsController controller, but it wasn't at the top of the stack

    I understand that this is a error, but I do not know how to get around, someone can help?

    1846 Views
Page: 1 2
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.