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...

CommentFileSizeAuthor
#2 exchange_rates-phpcs-report.txt6.98 KBcristian100

Comments

dystopianblue created an issue. See original summary.

cristian100’s picture

StatusFileSize
new6.98 KB

Hi 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!

cristian100’s picture

Hi 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!

avpaderno’s picture

Issue summary: View changes

Thank 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.

avpaderno’s picture

Status: Needs review » Needs work
  • What follows is a quick review of the project; it doesn't mean to be complete
  • For every point, I didn't make a complete list of where the code should be fixed, but an example of what is wrong in the code
  • Not all the points are application stoppers; some of them describe changes that would be preferable to make
  1. The code should not use the Drupal class or t() when dependency injection is available, for example inside plugin classes
  2. The code doesn't follow the Drupal coding standards in many points
dystopianblue’s picture

Status: Needs work » Needs review

Thanks cristian100 and kiamlaluno. I've committed fixes based on phpcs and PAReview to 8.x-1.x

klausi’s picture

Status: Needs review » Reviewed & tested by the community

Thanks 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.

dystopianblue’s picture

Thanks for the feedback, klausi. I resolved those issues and pushed the code to 8.x-1.x.

avpaderno’s picture

Assigned: Unassigned » avpaderno
Status: Reviewed & tested by the community » Fixed

Thank 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.

Status: Fixed » Closed (fixed)

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