We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) in our country

Commit 502c121e authored by Rik ter Beek's avatar Rik ter Beek Committed by GitHub

Merge pull request #158 from Adyen/issue-154

Fallback to Magento/blank theme when no theme is detected
parents 975e9908 a51649f3
...@@ -80,6 +80,16 @@ class PaymentMethods extends AbstractHelper ...@@ -80,6 +80,16 @@ class PaymentMethods extends AbstractHelper
*/ */
protected $_assetSource; protected $_assetSource;
/**
* @var \Magento\Framework\View\DesignInterface
*/
protected $_design;
/**
* @var \Magento\Framework\View\Design\Theme\ThemeProviderInterface
*/
protected $_themeProvider;
/** /**
* PaymentMethods constructor. * PaymentMethods constructor.
* *
...@@ -93,6 +103,8 @@ class PaymentMethods extends AbstractHelper ...@@ -93,6 +103,8 @@ class PaymentMethods extends AbstractHelper
* @param \Magento\Framework\View\Asset\Repository $assetRepo * @param \Magento\Framework\View\Asset\Repository $assetRepo
* @param \Magento\Framework\App\RequestInterface $request * @param \Magento\Framework\App\RequestInterface $request
* @param \Magento\Framework\View\Asset\Source $assetSource * @param \Magento\Framework\View\Asset\Source $assetSource
* @param \Magento\Framework\View\DesignInterface $design
* @param \Magento\Framework\View\Design\Theme\ThemeProviderInterface $themeProvider
*/ */
public function __construct( public function __construct(
\Magento\Quote\Api\CartRepositoryInterface $quoteRepository, \Magento\Quote\Api\CartRepositoryInterface $quoteRepository,
...@@ -104,7 +116,9 @@ class PaymentMethods extends AbstractHelper ...@@ -104,7 +116,9 @@ class PaymentMethods extends AbstractHelper
\Adyen\Payment\Logger\AdyenLogger $adyenLogger, \Adyen\Payment\Logger\AdyenLogger $adyenLogger,
\Magento\Framework\View\Asset\Repository $assetRepo, \Magento\Framework\View\Asset\Repository $assetRepo,
\Magento\Framework\App\RequestInterface $request, \Magento\Framework\App\RequestInterface $request,
\Magento\Framework\View\Asset\Source $assetSource \Magento\Framework\View\Asset\Source $assetSource,
\Magento\Framework\View\DesignInterface $design,
\Magento\Framework\View\Design\Theme\ThemeProviderInterface $themeProvider
) { ) {
$this->_quoteRepository = $quoteRepository; $this->_quoteRepository = $quoteRepository;
$this->_quoteIdMaskFactory = $quoteIdMaskFactory; $this->_quoteIdMaskFactory = $quoteIdMaskFactory;
...@@ -116,7 +130,8 @@ class PaymentMethods extends AbstractHelper ...@@ -116,7 +130,8 @@ class PaymentMethods extends AbstractHelper
$this->_assetRepo = $assetRepo; $this->_assetRepo = $assetRepo;
$this->_request = $request; $this->_request = $request;
$this->_assetSource = $assetSource; $this->_assetSource = $assetSource;
$this->_design = $design;
$this->_themeProvider = $themeProvider;
} }
/** /**
...@@ -208,11 +223,24 @@ class PaymentMethods extends AbstractHelper ...@@ -208,11 +223,24 @@ class PaymentMethods extends AbstractHelper
// add icon location in result // add icon location in result
if ($this->_adyenHelper->showLogos()) { if ($this->_adyenHelper->showLogos()) {
// Fix for MAGETWO-70402 https://github.com/magento/magento2/pull/7686
// Explicitly setting theme
$themeCode = "Magento/blank";
$themeId = $this->_design->getConfigurationDesignTheme(\Magento\Framework\App\Area::AREA_FRONTEND);
if(!empty($themeId)) {
$theme = $this->_themeProvider->getThemeById($themeId);
if($theme && !empty($theme->getCode())) {
$themeCode = $theme->getCode();
}
}
$params = []; $params = [];
// use frontend area $params = array_merge([
$params = array_merge(['area' => 'frontend', '_secure' => $this->_request->isSecure()], $params); 'area' => \Magento\Framework\App\Area::AREA_FRONTEND,
'_secure' => $this->_request->isSecure(),
'theme' => $themeCode
], $params);
$asset = $this->_assetRepo->createAsset('Adyen_Payment::images/logos/' . $asset = $this->_assetRepo->createAsset('Adyen_Payment::images/logos/' .
$paymentMethodCode . '.png', $params); $paymentMethodCode . '.png', $params);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment