I'm trying to add a checkbox to posts that allows users to toggle a change to the way the post is presented in a thread.
I've successfully added a column to the xf_post table. I have a listener that exposes the data to the post, and I'm able to both show a checkbox in the post_edit template populated with the right value and add a css class in post_macros where I need it. I manually flagged some posts in the database to test it out and these parts work great.
However, I'm struggling to figure out how to make the data persist when saved. Editing a post and checking an unchecked box (or vice versa) doesn't save the value to the db table.
The addon tutorial has a section about "Extending the forum save process", but there doesn't seem to be an equivalent to XF/Admin/Controller/Forum.php's saveTypeData in XF/Entity/Post.php, nor have I been able to figure out where else I might hook into this process.
I'm also not sure what the best way is to dump variables during post save. I haven't had any luck with \XF::dump because the post save process happens via JS.
Any guidance is appreciated.
I've successfully added a column to the xf_post table. I have a listener that exposes the data to the post, and I'm able to both show a checkbox in the post_edit template populated with the right value and add a css class in post_macros where I need it. I manually flagged some posts in the database to test it out and these parts work great.
However, I'm struggling to figure out how to make the data persist when saved. Editing a post and checking an unchecked box (or vice versa) doesn't save the value to the db table.
The addon tutorial has a section about "Extending the forum save process", but there doesn't seem to be an equivalent to XF/Admin/Controller/Forum.php's saveTypeData in XF/Entity/Post.php, nor have I been able to figure out where else I might hook into this process.
I'm also not sure what the best way is to dump variables during post save. I haven't had any luck with \XF::dump because the post save process happens via JS.
Any guidance is appreciated.