Closed (fixed)
Project:
Commerce Core
Version:
7.x-1.x-dev
Component:
Commerce
Priority:
Minor
Category:
Task
Assigned:
Reporter:
Created:
29 Mar 2011 at 00:52 UTC
Updated:
12 May 2011 at 20:51 UTC
Jump to comment: Most recent file
Well, this is just a minor issue that concerns on documentation consistency.
As described here, there should do not exist a hook_commerce_currency_info(), since Commerce is expected to define all the legal currencies.
Modules may use hook_commerce_currency_info_alter(&$currencies) to define possible needed currencies.
So, at commerce.module:249 there is:
module_load_include('inc', 'commerce', 'includes/commerce.currency');
$currencies = module_invoke_all('commerce_currency_info');
drupal_alter('commerce_currency_info', $currencies);
In fact, commerce.currency.inc has a hook_commerce_currency_info() implementation.
So, any module could implement hook_commerce_currency_info(), contradicting the description above.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | hook-commerce-currency-info-review-1108752-4.patch | 857 bytes | eltermann |
| removing-hook-commerce-currency-info.patch | 1.24 KB | eltermann |
Comments
Comment #1
yasminpibo commentedComment #2
rszrama commentedHmm, interesting. Your patch definitely fixes the disparity between the documentation and the code, but I wonder which is better... leave the code as is and change the documentation, or apply your patch so the code conforms to the documentation? I could go either way, really, but I have to wonder if we choose to just change the documentation for the sake of websites using fake / custom currencies (i.e. reward points, user points, etc.). As the documentation indicates, those can still be accommodated through currency alteration, but then you can introduce conflicts between modules implementing the currency alteration hook.
I'll get a second opinion from Damien. My hunch based on conversations with him about fake currencies is that he'd prefer to update the docs.
Comment #3
rszrama commentedThought about this a little more. I think we should just update the documentation and document the hook in the .api.php file.
Comment #4
eltermann commentedcommerce.api.php file has already the documentation of hook_commerce_currency_info() and hook_commerce_currency_info_alter().
The patch I'm posting is just to let array format as Drupal coding standards: http://drupal.org/coding-standards#array
I'll write a text to documentation of "Commerce info hooks" (http://www.drupalcommerce.org/specification/info-hooks/commerce) and then post it here.
Comment #5
eltermann commentedText submitted on documentation: http://www.drupalcommerce.org/specification/info-hooks/commerce
Comment #6
rszrama commentedGreat! I committed the patch and tweaked the docs just a little bit, as I had some other inaccurate information in there about currency info being objects vs. arrays (everything's an array now) and hadn't documented the conversion_rate property there yet.