The naming of the existing Views handlers does not follow the pattern specified in the Views documentation:

[module]_handler_[type]_[tablename]_[fieldname]

All the handlers need to be updated to conform to this pattern.

Comments

pcambra’s picture

Taking care of this, from views docs: http://views-help.doc.logrus.com/help/views/api-handlers
Sometimes table and fieldname are not appropriate, but something that resembles what the table/field would be can be used

pcambra’s picture

Assigned: Unassigned » pcambra
Status: Active » Needs review

Git pull requested in github for this issue (not 100% sure if this is the correct procedure or if I should upload a patch here as well)

One question about views hanlders in commerce_product module, there is one for the link of the product that is not used for display purposes, only for base of the edit/delete handlers, formerly was called views_handler_field_commerce_product_link and now commerce_product_handler_field_product_link.
In commerce_order module a similar handler is used both for display as well as for base.

rszrama’s picture

Hmm, yeah, I think it's b/c when I wrote that integration I wasn't sure we'd have an actual "View" page for products. It makes sense to include, even if the URL will be an admin URL, so I've just recently added the necessary build mode for products (like in the last two days). We'll need to add further integration for products with Views now.

Will pull from you and give it a test drive shortly. : )

rszrama’s picture

Status: Needs review » Needs work

The pull request worked fine. I pulled your code into my Git repository and tested a fresh install. Everything worked just fine. : )

I think the following things need to be addressed before I mark this fixed:

  1. The line item handlers weren't updated.
  2. I see that some of your handlers duplicated the module name to include the [table_name] part of the Views standard. Others weren't affected, and that's most likely because they don't have associated table names (looks like it was the link ones). I think we should pick a single standard that works for everything... like either always duplicate the table name (i.e. commerce_order_handler_field_commerce_order_order.inc) or just don't include it at all (i.e. commerce_order_handler_field_order.inc). I think I prefer the second just because it's shorter, but I'm up for other ideas.

Since I've pulled from you, I'm not exactly sure how you should resync with my repository. I wonder if you now need to "git pull" from me before you do further work on your end?

pcambra’s picture

1. Oops, sorry about that, I didn't see them.
2. I was thinking the same as I was changing the names, I tried to respect the views naming, but in some things, like link editing, there is no field, I like the second option too, but what if the module implements a handler for a table which does not have the same name, ie commerce_order_handler_field_other_table_fieldname?

About git, I'm not sure neither, if you didn't push my changes to the online repos, you should still be able to reverse my changes in your repos so I can request another pull and you would download the changes? or maybe I should discard my fork and fork again from your repos?

rszrama’s picture

Hmm, so I pulled from you and then pushed to my repo, and without me having to do anything your commits no longer appear in my fork queue. I suppose that means we're kosher - you can just make further changes to your local repo and send another pull request.

As for the instances of Views integration for modules with multiple tables, I think you're right - several do, and in instances like the Order module we'll have commerce_order and commerce_order_revision. Maybe we can adopt a compromise solution:

  1. Keep the [table_name]_[field_name] where appropriate, but use a shortened table name - i.e. don't repeat the commerce_. There's precedent for this in the way we're naming the modules directories.
  2. For the generic entity / link handlers, keep it as you have it.

I think the full list of handlers would become:

commerce_line_item_handler_argument_line_item_line_item_id.inc
commerce_line_item_handler_field_line_item_line_item_type.inc

commerce_order_handler_field_order.inc
commerce_order_handler_field_order_link.inc
commerce_order_handler_field_order_link_delete.inc
commerce_order_handler_field_order_link_edit.inc
commerce_order_handler_field_order_order_status.inc
commerce_order_handler_argument_order_order_id.inc

commerce_product_handler_field_product.inc
commerce_product_handler_field_product_link.inc
commerce_product_handler_field_product_link_delete.inc
commerce_product_handler_field_product_link_edit.inc
commerce_product_handler_field_product_product_type.inc

If that looks good to you and you have time to make the changes, just send me a pull request on GitHub when it's done. Ohloh's picking up on your commits when I git pull from you. You can claim them as yours if you have an account. It's fun to see more contributors in there. : )

https://www.ohloh.net/p/drupalcommerce/contributors

rszrama’s picture

I just committed the Views integration for a normal product link field per your suggestion. I also updated the default product View. You'll probably need to pull those commits from my repo before sending a pull request for the handler changes.

pcambra’s picture

Ok, will do that, I'll try to change in a couple of days :)

I've created an ohloh account, now I have to figure out how to claim those commits ;)

rszrama’s picture

If you haven't already found it, you should be able to just click the "I am this person" button at your contributor page:

https://www.ohloh.net/p/drupalcommerce/contributors/1684200558214278

pcambra’s picture

Thanks rszrama, I've just claimed my ohloh profile :)
I have changed all handlers in my local copy after pulling from your repos and when I've properly retested them, I will request another git push.
(note to myself in the future: git pull git://github.com/rszrama/drupalcommerce.git master)

The field in the commerce_order table is "status" so I've changed this handler's name
commerce_order_handler_field_order_order_status.inc
for
commerce_order_handler_field_order_status.inc
to have all named the same way.

rszrama’s picture

Ahh, good catch.

pcambra’s picture

Status: Needs work » Needs review

Pull requested on github

rszrama’s picture

Status: Needs review » Fixed

Committed! I made one final tweak and that was to the line item / product type handlers. The field in the DB is simply called "type" for both of those, so I removed the extra line_item_ and product_ prefixes. Thanks, Pedro! : )

Status: Fixed » Closed (fixed)
Issue tags: -low-hanging fruit

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