Closed (fixed)
Project:
Ubercart
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Feb 2010 at 22:21 UTC
Updated:
19 Mar 2010 at 14:10 UTC
Jump to comment: Most recent file
Comments
Comment #1
univate commentedThe purpose of drupal_alter is to pass a variable (array or object) that can be manipulated by other modules. Also with D7 there is a general rule of removing $op function variables in functions in favour of separate functions for each $op.
see http://api.drupal.org/api/function/drupal_alter/7
The drupal_alter function in question is:
Where the 2nd argument is being used as a $op variable to select a specific table.
There is also another alter function defined in the api that implements drupal_alter incorrectly:
The solution here should be to change the alter function to something like:
Comment #2
univate commentedComment #3
Docc commentedSomething like this?
Comment #4
Island Usurper commentedhook_tapir_table_alter() was based off of hook_form_alter(), and I don't think the $form_id parameter is ever going to go away. It's interesting, though, that this means that $form_id is passed by reference to hook_form_alter(). Don't anyone take advantage of that, though.
If you want table-specific table alter hooks, it's easy to add them in. However, the proper solution for this issue is to just put 'uc_product_table' into a variable, and pass that to drupal_alter() instead. That means far fewer changes across the board, and we're still doing things the Drupal way.
Comment #5
univate commentedIf you just create a variable for the purpose of passing this information it wont make a different what anyone does with it.
Rereading the docs: http://api.drupal.org/api/function/drupal_alter/7 it does talk about passing variables as a $context, so I guess your solution of making it a variable is fine.
Comment #6
Island Usurper commentedMade this change as I was testing the port. Thanks for the early warning.