Hi guys,
Following up with #1319810: Improve Entity Relationships in Views, I was brought to look closer at the Product Reference and Customer modules.
Currently, both modules seem to implement hook_field_views_data in different places and I was wondering if it would be possible to make the code consistent:
-
Product Reference seems to implement hook_field_views_data in commerce_product_reference.views.inc, line 11:
function commerce_product_reference_field_views_data($field)
which I would assume would be the right file for this hook's implementation (the .views.inc file). -
Customer, which has its own reference field commerce_customer_profile_reference defined in commerce_customer.module, line 759, also seems to implement hook_field_views_data in commerce_customer.module, line 423:
function commerce_customer_field_views_data($field)
which I was a little surprised to find in this file, since I had initially been looking at commerce_product_reference.views.inc. So logically, I looked at commerce_customer.views.inc but couldn't find it there.
Would there be any particular reason why hook_field_views_data would be implemented in commerce_customer.module rather than commerce_customer.views.inc?
This may sound pretty minor, but I think it would be a rather easy/simple change that could get modules' code aligned with the same consistency.
I would greatly appreciate to have your feedback on that and if you could let me know if I overlooked or missed anything in any of these modules' implementations or APIs.
Feel free to let me know if you would have any questions, comments or concerns on any aspects of the discussed implementations, I would be glad to explain in more details.
Thanks very much to all, in advance, for your comments, feedback, and insight.
Cheers!
Comment | File | Size | Author |
---|---|---|---|
#7 | move-1916910-7.patch | 3.33 KB | joelpittet |
#1 | commerce-move-commerce_customer_field_views_data-to-views-file-1916910-1.patch | 3.08 KB | DYdave |
Comments
Comment #1
DYdave CreditAttribution: DYdave commentedQuick follow up on this ticket.
Please find attached to this comment a patch against the 7.x-1.x version at ed9d68b in response to the suggested changes in ticket summary: commerce-move-commerce_customer_field_views_data-to-views-file-1916910-1.patch
I would guess the way it was done in Product Reference was probably the correct one, with its hook_field_views_data implementation in commerce_product_reference.views.inc, so this patch simply moves the function commerce_customer_field_views_data from commerce_customer.module, to commerce_customer.views.inc.
Patch has been tested and seems to work as expected.
Please let me know if you would have any questions, objections, comments, suggestions, recommendations or concerns on the patch or the request above, I would be glad to explain in more details or re-roll the patch if necessary.
I would greatly appreciate some help from module maintainers and if any of you could take a bit of time to look into the attached patch to give me your feedback/opinion on this ticket.
Any feedback, testing, changes, recommendations would be highly appreciated.
Thanks to all in advance.
Cheers!
Comment #3
DYdave CreditAttribution: DYdave commentedI checked, but I'm not really sure why the tests failed in #2.
Changing the status manually to needs review as an attempt to request a manual review from maintainers and other developers.
Please let me know if you are able to identify why patch from #1 would have failed, I would be glad to have it edited and re-rolled.
Thanks in advance for all your comments, feedback and testing.
Cheers!
Comment #4
rszrama CreditAttribution: rszrama commented#1: commerce-move-commerce_customer_field_views_data-to-views-file-1916910-1.patch queued for re-testing.
Comment #5
joelpittetThis seems like the right approach here.
Comment #6
joelpittetNeeds a re-roll actually.
Comment #7
joelpittetRe-rolled.
Comment #8
joelpittetThis is a nice clean-up. Also since I didn't change code (at least I don't think I did back in July) and I already RTBC'd it I'm just re-RTBCing this.
Comment #9
rszrama CreditAttribution: rszrama at Centarro commentedCommitted.