XF 2.2 Custom inline moderation help

Gobb

Member
Hey guy,

So I've got as far as the inline moderation popping up with the content I'm selecting and I have been able to add my custom actions which then open up the overlay form. However, I am really struggling complete the updates once the overlay form is posted. I've looked over the XenForo files a bunch but am just going in circles.

My main issue is the ids hidden input field in the form are the ids of the content I want updated, but I can't see how this can be done as I don't understand what the entity value is in the function applyToEntity(Entity $entity, array $options) or how I can use this to update the data. Should I even be trying to do it this way, or just simply make the inline mod overlay post to a standard controller and update the data that way? That seems like it would be a lot simpler.

Thanks.
 
The $entity is the corresponding entity object for one of the selected pieces of content. For example, if your inline moderation action were for a thread, it would be an \XF\Entity\Thread object.
 
Should I even be trying to do it this way, or just simply make the inline mod overlay post to a standard controller and update the data that way? That seems like it would be a lot simpler.
I encourage you to do everything in XenForo standards, even if it is much simpler because that little bit of experience goes a long way. It will definitely help with your next add-on and it makes the case that the day you make a masterpiece is closer. You might not use the applyToEntity in your next add-ons but it helps you to understand other XenForo concepts.
 
The $entity is the corresponding entity object for one of the selected pieces of content. For example, if your inline moderation action were for a thread, it would be an \XF\Entity\Thread object.
Thanks for your response. I assumed that was the case. Not really sure if this is right, but I couldn't get the database to write using the applyToEntity function, however it does work with the apply function and looping through the entity. I believe the issue is the entity that is defined in the content types is different to the one I'm using to actually write to the database. If those entities need to match, I'll just have to do it another way.
I encourage you to do everything in XenForo standards, even if it is much simpler because that little bit of experience goes a long way. It will definitely help with your next add-on and it makes the case that the day you make a masterpiece is closer. You might not use the applyToEntity in your next add-ons but it helps you to understand other XenForo concepts.
That's what I'm trying to do, yeah. I couldn't get it to worth with the applyToEntity function but I did with the apply function, but I feel like that's not really correct and kind of a hack move lol.
 
Back
Top Bottom