Skip to content

Commit

Permalink
Refactor library definition
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleh Vehera committed Apr 24, 2022
1 parent 3279ebd commit 0119d72
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions commerce_viva.libraries.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
donate-sdk.js:
donate-sdk:
js:
https://www.paypalobjects.com/donate/sdk/donate-sdk.js: { type: external, minified: true }
donate-sdk-inline.js:
donate-sdk-inline:
js:
src/assets/js/donate-sdk-inline.js: {}
js/donate-sdk-inline.js: {}
dependencies:
- commerce_viva/donate-sdk.js
- commerce_viva/donate-sdk
11 changes: 11 additions & 0 deletions js/donate-sdk-inline.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
(function (PayPal) {
PayPal.Donation.Button({
env: 'production',
hosted_button_id: 'L2PVSYTGQUECW',
image: {
src: 'https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif',
alt: 'Donate with PayPal button',
title: 'PayPal - The safer, easier way to pay online!',
}
}).render('#donate-button');
})(PayPal);
2 changes: 1 addition & 1 deletion src/Plugin/Commerce/PaymentGateway/VivaRedirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
'button' => [
'#type' => 'container',
'#attributes' => ['id' => 'donate-button'],
'#attached' => ['library' => ['commerce_viva/donate-sdk-inline.js']],
'#attached' => ['library' => ['commerce_viva/donate-sdk-inline']],
],
];

Expand Down
11 changes: 0 additions & 11 deletions src/assets/js/donate-sdk-inline.js

This file was deleted.

0 comments on commit 0119d72

Please sign in to comment.