Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-payment
Model
CcConfigProvider.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Payment\Model
;
7
8
use
Magento\Checkout\Model\ConfigProviderInterface
;
9
use
Magento\Framework\View\Asset\Source
;
10
17
class
CcConfigProvider
implements
ConfigProviderInterface
18
{
22
private
$icons = [];
23
27
protected
$ccConfig
;
28
32
protected
$assetSource
;
33
38
public
function
__construct
(
39
CcConfig
$ccConfig
,
40
Source
$assetSource
41
) {
42
$this->ccConfig =
$ccConfig
;
43
$this->assetSource =
$assetSource
;
44
}
45
49
public
function
getConfig
()
50
{
51
return
[
52
'payment'
=> [
53
'ccform'
=> [
54
'icons'
=> $this->
getIcons
()
55
]
56
]
57
];
58
}
59
65
public
function
getIcons
()
66
{
67
if
(!empty($this->icons)) {
68
return
$this->icons;
69
}
70
71
$types = $this->ccConfig->getCcAvailableTypes();
72
foreach
(array_keys($types) as
$code
) {
73
if
(!array_key_exists(
$code
, $this->icons)) {
74
$asset = $this->ccConfig->createAsset(
'Magento_Payment::images/cc/'
. strtolower(
$code
) .
'.png'
);
75
$placeholder = $this->assetSource->findSource($asset);
76
if
($placeholder) {
77
list($width, $height) =
getimagesize
($asset->getSourceFile());
78
$this->icons[
$code
] = [
79
'url'
=> $asset->getUrl(),
80
'width'
=> $width,
81
'height'
=> $height
82
];
83
}
84
}
85
}
86
87
return
$this->icons;
88
}
89
}
Magento\Framework\View\Asset\Source
Definition:
Source.php:21
Magento\Framework\Image\Adapter\getimagesize
getimagesize($file)
Definition:
global_php_mock.php:33
Magento\Payment\Model\CcConfigProvider\getIcons
getIcons()
Definition:
CcConfigProvider.php:65
Magento\Payment\Model\CcConfigProvider\$ccConfig
$ccConfig
Definition:
CcConfigProvider.php:27
Magento\Checkout\Model\ConfigProviderInterface
Definition:
ConfigProviderInterface.php:13
Magento\Payment\Model\CcConfigProvider\getConfig
getConfig()
Definition:
CcConfigProvider.php:49
Magento\Payment\Model
Magento\Payment\Model\CcConfigProvider\$assetSource
$assetSource
Definition:
CcConfigProvider.php:32
Magento\Payment\Model\CcConfigProvider
Definition:
CcConfigProvider.php:17
Magento\Payment\Model\CcConfigProvider\__construct
__construct(CcConfig $ccConfig, Source $assetSource)
Definition:
CcConfigProvider.php:38
Magento\Payment\Model\CcConfig
Definition:
CcConfig.php:21
$code
$code
Definition:
info.phtml:12