Hello! Great thanks for this needed new module!
There is 2 troubles using Comment fields:
I turned on the comment_field_example module and added in comment_fields_example.module 2 my arrays of fields (save 'birthday' and 'feeling' there were 4 fields). After I put only my 2 vars (no 'birthday' and 'feeling') into file comment-mynodetype.tpl.php template and put it in my theme directory, and after I saw:
1. All the same there was all 4 fields in comment form, although I didn't add 'birthday' and 'feeling' field in comment-mynodetype.tpl.php.
2. All my node types has the same fields (4 fields), although I created only comment-mynodetype.tpl.php.
I tried to delete comment.tpl.php from comment_example module directory but nothing had been changed.
Please, say me - if #1 works as designed I can create new module for different fields in different node types but how to be with #2? Does it works as designed too. If so, this issue should be feature request.
Great Thanks for help!
Comments
Comment #1
aklump commentedHi kaztur, thanks for your questions...
1) I would suggest copying the example module to sites/all/modules/custom/ where you can rename it and modify it as needed. You should replace the current code in comment_fields_example_comment_fields_info_alter with your own. All the definitions there will appear in your tpls.
2) I think you need to replace $info['all'] with the $info[NODE_TYPE] and you will see the fields only on the intended node types.
I added more explanation to the files in version 6.x-1.1, which you can download and try to use now instead of 1.0. It will also address the other issue you found.
Thanks!
aklump
Comment #2
aklump commentedComment #3
kaztur commentedaklump, Great Thanks for Your answer! It's rare when maintainers answer so fastly.
The error in other issue has gone and I understooden how to divide comment fields via content types.
But now there's nothing instead of value in the fields (in both content types I created fields for).
I've done such changes (sorry for my laziness, but I do it in Yout module :) )
1. comment_fields_example.module:
2. comment-kazan_hotel.tpl.php:
3. comment-firm.tpl.php:
In both content types there's nothig instead of values.
I tried to delete 'if' operators - then there was only static text also without values (like "Manager name: .").
Thank You!
Comment #4
aklump commentedI discovered that by using the textfield fapi elements the way this was originally setup would not allow this work correctly. I have refactored the code and I'm hoping that solves the issues your facing. Please let me know after downloading version 1.2
Comment #5
kaztur commentedaklump, 1.2. version works perfectly!
Great Thanks again! :)
P.S. So, if I spread some not by theme here, I note that Comments Fields is fully compatible with ajax comments module.
Comment #6
aklump commentedGreat! Glad to hear it.