Provides a block which converts a base currency to multiple foreign currencies using exchangeratesapi.io, a free service that provides the latest foreign exchange rates from the European Central Bank. The block supports up to 32 foreign currencies:
- Australian Dollar (A$)
- Bulgarian Lev (BGN)
- Brazilian Real (R$)
- Canadian Dollar (CA$)
- Swiss Franc (CHF)
- Chinese Yuan (CN¥)
- Czech Republic Koruna (CZK)
- Danish Krone (DKK)
- Euro (€)
- British Pound (£)
- Hong Kong Dollar (HK$)
- Croatian Kuna (HRK)
- Hungarian Forint (HUF)
- Indonesian Rupiah (IDR)
- Israeli New Sheqel (₪)
- Indian Rupee (Rs.)
- Icelandic Króna (ISK)
- Japanese Yen (¥)
- South Korean Won (₩)
- Mexican Peso (MX$)
- Malaysian Ringgit (MYR)
- Norwegian Krone (NOK)
- New Zealand Dollar (NZ$)
- Philippine Peso (Php)
- Polish Zloty (PLN)
- Romanian Leu (RON)
- Russian Ruble (RUB)
- Swedish Krona (SEK)
- Singapore Dollar (SGD)
- Thai Baht (THB)
- Turkish Lira (TRY)
- US Dollar ($)
- South African Rand (ZAR)
Configuration
The Exchange Rates settings page is at /admin/config/regional/exchange-rates where the base currency and up to 32 foreign currencies can be selected for display.
Block
To display the Exchange Rates block, go to /admin/structure/block and select Place block for the region where you want the block displayed. The block name is Exchange Rates.
Project link
https://www.drupal.org/project/exchange_rates
Git instructions
git clone --branch 8.x-1.x https://git.drupalcode.org/project/exchange_rates.git
PAReview checklist
https://pareview.sh/pareview/https-git.drupal.org-project-exchange_rates...
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | exchange_rates-phpcs-report.txt | 6.98 KB | cristian100 |
Comments
Comment #2
cristian100Hi Ray, thank you for your contribution!
Reviewing this project, I can see that code could improve by following Drupal coding standards. For your convenience I've run phpcs using drupal standard to review, I'm attaching the report for you to see it:
PHP Code Sniffer Report
I would recommend install phpcs with drupal standard and then run this command:
phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md --ignore=node_modules,bower_components,vendor,min.css,min.js /path/to/project_module
Peace!
Comment #3
cristian100Hi Ray, I've created an issue in the project page:
https://www.drupal.org/project/exchange_rates/issues/3057759
And also provided a patch that updates code to match Drupal coding standards:
https://www.drupal.org/project/exchange_rates/issues/3057759#comment-131...
Have a nice day!
Comment #4
avpadernoThank you for applying! I added the PAReview checklist link. Reviewers will check the project and post comments to list what should be changed.
If you haven't done it, yet, please check the PAReview report and fix what needs to be fixed. There could be some false positives; verify that what reported is correct, before making any change.
Comment #5
avpadernoDrupalclass ort()when dependency injection is available, for example inside plugin classesComment #6
dystopianblue commentedThanks cristian100 and kiamlaluno. I've committed fixes based on phpcs and PAReview to 8.x-1.x
Comment #7
klausiThanks for your contribution!
* drupal_set_message() is deprecated and must not be used anymore.
* ExchangeRatesBlockForm: doc block is just a copy of the class name. Please describe what this class does and why.
* ExchangeRatesBlock: you are not catching Guzzle request exceptions here, so if the API is not available this will bring down your site.
Otherwise looks good to me, did not see any security issues.
Comment #8
dystopianblue commentedThanks for the feedback, klausi. I resolved those issues and pushed the code to 8.x-1.x.
Comment #9
avpadernoThank you for your contribution! I am going to update your account.
These are some recommended readings to help with excellent maintainership:
You can find more contributors chatting on the IRC #drupal-contribute channel. So, come hang out and stay involved.
Thank you, also, for your patience with the review process.
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
I thank all the dedicated reviewers as well.