A user filed this issue #1596666: Implement hook_mollom_form_info for submission protection by Mollom with 1 of my modules to implement hook_mollom_form_info for a particular fieldable entity.

To do this I realized I would have to copy some code from mollom.module

I will attach a patch that adds the function "mollom_add_entity_form_info" for now if just adds field info and entity_id for post_id.

I have changed node_mollom_form_info and comment_mollom_form_info to use this functions. So this adds Field API support for comments.

The idea is that any module that implements hook_mollom_form_info for a fieldable entity would use the function mollom_add_entity_form_info. This way if mollom added support for other field types than the current 'text', 'text_long', 'text_with_summary' types then each module would not have to update their code.

Comments

tedbow’s picture

Status: Active » Needs review
StatusFileSize
new2.6 KB

attaching patch

Status: Needs review » Needs work

The last submitted patch, mollom-add_field_entity_function-1597504-1.patch, failed testing.

tedbow’s picture

The last patch got rejected b/c of "Ensure the patch only contains unix-style line endings."

Could there have been existing non-unix line endings in the file? I haven't got this message before and I am working in Linux.

Anyways ran dos2unix which replaced a bunch of line endings.

tedbow’s picture

Status: Needs work » Needs review
sun’s picture

Title: Create functions for dealing with generic Fieldable entities » Generic form mappings for all (fieldable) entities
Issue tags: +Needs tests
StatusFileSize
new2.4 KB

wow. Lovely patch!

Though: I'm not sure how you managed to do it, if you're really on Linux, but your patch indeed contained a CRLF in the added/new lines of your patch in #1. All the other changes in #3 are different indentations.

Thus, re-rolled #1 without that CRLF, and some minor changes.

tedbow’s picture

StatusFileSize
new3.34 KB

wow. Lovely patch!

Thanks!

if you're really on Linux,

Indeed I am

So users are also fieldable entities so....
Should we add this function to user_register_form - since you can have text fields on the User object? Maybe if no one has asked for it, it's not worth it.

Also node_profile_form, because it could have fields.

I have attached a patch with these changes if you think it makes sense.

sun’s picture

Status: Needs review » Fixed
StatusFileSize
new4.91 KB

Thanks for reporting, reviewing, and testing! Committed attached patch to 7.x-2.x.

A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit 7c156d9 on 7.x-2.x, 8.x-2.x, fbajs, actions authored by tedbow, committed by sun:
    - #1597504 by tedbow, sun: Added Generic form mappings for all (...

  • Commit 7c156d9 on 7.x-2.x, 8.x-2.x, fbajs, actions authored by tedbow, committed by sun:
    - #1597504 by tedbow, sun: Added Generic form mappings for all (...