Jump to content

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


Go to solution Solved by Daniel F,

Recommended Posts

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().

Posted

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. 🤷‍♂️

Posted

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.

 

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...