Maybe I'm wrong but it looks like after a save it's impossible to alter the values of $checkout_panes by using commerce_checkout_pane_info_alter().
Attached patch should fix that.

Btw. is array_merge really necessary here?

Comments

rszrama’s picture

Haven't had a chance to test the patch yet, but yes, the merge is a necessary evil until #875034: Convert hook_*_info() hooks to return arrays instead of objects is implemented.

rszrama’s picture

Ahh, I see what you mean... yeah, it's redundant to use an array_merge() when the first argument is an array merged via the + operator. : P

In any event, it does seem like a weird place to allow alteration... it should at least be after default values have been set. That said, I'm a little leery of allowing alteration after values have been loaded from the database, since the loading of values from the database is effectively an alter administered through the UI. However, it still might be the right thing to do... I'll think on it. In the meantime, we have removed that +.

rszrama’s picture

Status: Needs review » Fixed

Ok, what I ended up doing with this (finally) is moving the code that merges in data from the settings form into the previous foreach loop. So the chain of data inclusion goes like this:

  1. Data as defined by the info hook.
  2. Values merged in from the settings form.
  3. Additional values / changes via an alter hook.
  4. Defaults added in for any missing keys.

Commit: http://drupalcode.org/project/commerce.git/commitdiff/a0566a7

Status: Fixed » Closed (fixed)

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