-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove MethodMetaData and replace with IconRenderer to show icons
- Loading branch information
1 parent
ecea229
commit 278b58c
Showing
4 changed files
with
37 additions
and
40 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace Buckaroo\HyvaCheckout\Plugin; | ||
|
||
use Hyva\Checkout\Model\MethodMetaData\IconRenderer as IconRendererHyva; | ||
use Magento\Framework\View\Asset\Repository; | ||
|
||
class IconRenderer | ||
{ | ||
protected Repository $assetRepository; | ||
|
||
public function __construct( | ||
Repository $assetRepository | ||
) { | ||
$this->assetRepository = $assetRepository; | ||
} | ||
|
||
public function aroundRender( | ||
IconRendererHyva $subject, | ||
callable $proceed, | ||
array $icon | ||
): string { | ||
// Check if this is a Buckaroo method and handle it | ||
if (isset($icon['svg']) && strpos($icon['svg'], 'Buckaroo_') !== false) { | ||
$logoLink = $this->assetRepository->getUrl($icon['svg']); | ||
return '<img style="height:30px" src="' . $logoLink . '">'; | ||
} | ||
|
||
// Otherwise, proceed with the default behavior | ||
return $proceed($icon); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters