Jump to content

[BUG 4.7.17] Adding form fields to \IPS\Content\Item::commentFormElements() doesn't fully work

Featured Replies

Posted

I'm adding some custom fields to a comment form in an application, however, adding them is a nightmare, unlike the normal form for the item itself.

  • I had to alter the commentTemplate form template to place the fields in the correct position above the editor. Without the template edit, the fields were added at the bottom inline with the submit button, and the whole look was messed up.
  • There is no easy way to only overload the comment template. I had to copy both commentContainer and comment to use my custom comment template.
  • The \IPS\Content\Controller::_edit() class that loads the edit code/form doesn't use \IPS\Content\Item::commentFormElements() to load the fields, so I had to overload the whole function and add my own field code in there since there is no usable hook point/extension that can be used.
  • The same also applies to \IPS\Content\Item::processCommentForm() since it's not called when editing a comment.

 

Overall the whole process of adding fields to a comment form is a mess. And I assume the same applies to the review form.

 

I expected it to work as it does for items with formElements() and processForm().

Solved by Daniel F

Go to solution
  • Author

So, it seems that \IPS\Content\Item::processCommentForm() does not save any values/changes you make to it unless you call save() yourself.

 

That's another difference compared to how the Content Item itself is handled. 🤷‍♂️

Thank you for bringing this issue to our attention! I can confirm this should be further reviewed and I have logged an internal bug report for our development team to investigate and address as necessary, in a future maintenance release.

 

  • Solution

The way how this works in v5 changed completely and this would be some too big changes for v4 so we'll probably close the bug report for now.

  • Author

Yeah, I figured it wouldn't change for v4 at this point.

 

I'm good as long as it's easier to implement it in v5. 👍

Recently Browsing 0

  • No registered users viewing this page.