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-captcha
Model
Checkout
ConfigProvider.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Captcha\Model\Checkout
;
7
8
class
ConfigProvider
implements
\Magento\Checkout\Model\ConfigProviderInterface
9
{
13
protected
$storeManager
;
14
18
protected
$captchaData
;
19
23
protected
$formIds
;
24
30
public
function
__construct
(
31
\
Magento
\Store\Model\StoreManagerInterface
$storeManager
,
32
\
Magento
\Captcha\Helper\
Data
$captchaData
,
33
array
$formIds
34
) {
35
$this->storeManager =
$storeManager
;
36
$this->captchaData =
$captchaData
;
37
$this->formIds =
$formIds
;
38
}
39
43
public
function
getConfig
()
44
{
45
$config
= [];
46
foreach
($this->formIds as $formId) {
47
$config
[
'captcha'
][$formId] = [
48
'isCaseSensitive'
=> $this->
isCaseSensitive
($formId),
49
'imageHeight'
=> $this->
getImageHeight
($formId),
50
'imageSrc'
=> $this->
getImageSrc
($formId),
51
'refreshUrl'
=> $this->
getRefreshUrl
(),
52
'isRequired'
=> $this->
isRequired
($formId)
53
];
54
}
55
return
$config
;
56
}
57
64
protected
function
isCaseSensitive
($formId)
65
{
66
return
(
boolean
)$this->
getCaptchaModel
($formId)->isCaseSensitive();
67
}
68
75
protected
function
getImageHeight
($formId)
76
{
77
return
$this->
getCaptchaModel
($formId)->getHeight();
78
}
79
86
protected
function
getImageSrc
($formId)
87
{
88
if
($this->
isRequired
($formId)) {
89
$captcha
= $this->
getCaptchaModel
($formId);
90
$captcha
->generate();
91
return
$captcha
->getImgSrc();
92
}
93
return
''
;
94
}
95
101
protected
function
getRefreshUrl
()
102
{
103
$store
= $this->storeManager->getStore();
104
return
$store
->getUrl(
'captcha/refresh'
, [
'_secure'
=>
$store
->isCurrentlySecure()]);
105
}
106
113
protected
function
isRequired
($formId)
114
{
115
return
(
boolean
)$this->
getCaptchaModel
($formId)->isRequired();
116
}
117
124
protected
function
getCaptchaModel
($formId)
125
{
126
return
$this->captchaData->getCaptcha($formId);
127
}
128
}
Magento\Captcha\Model\Checkout\ConfigProvider\getConfig
getConfig()
Definition:
ConfigProvider.php:43
Magento\Captcha\Model\Checkout\ConfigProvider\__construct
__construct(\Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Captcha\Helper\Data $captchaData, array $formIds)
Definition:
ConfigProvider.php:30
$config
$config
Definition:
fraud_order.php:17
Magento\Captcha\Model\Checkout\ConfigProvider\$captchaData
$captchaData
Definition:
ConfigProvider.php:18
Magento\Captcha\Model\Checkout\ConfigProvider\getCaptchaModel
getCaptchaModel($formId)
Definition:
ConfigProvider.php:124
Magento\Captcha\Model\Checkout\ConfigProvider\getImageSrc
getImageSrc($formId)
Definition:
ConfigProvider.php:86
Magento\Captcha\Model\Checkout\ConfigProvider\$storeManager
$storeManager
Definition:
ConfigProvider.php:13
Magento\Checkout\Model\ConfigProviderInterface
Definition:
ConfigProviderInterface.php:13
Magento
Magento\Captcha\Model\Checkout
Definition:
ConfigProvider.php:6
$captcha
$captcha
Definition:
default.phtml:12
$store
$store
Definition:
payment_configuration_rollback.php:33
Magento\Captcha\Model\Checkout\ConfigProvider
Definition:
ConfigProvider.php:8
Magento\Captcha\Model\Checkout\ConfigProvider\isRequired
isRequired($formId)
Definition:
ConfigProvider.php:113
Magento\Captcha\Model\Checkout\ConfigProvider\$formIds
$formIds
Definition:
ConfigProvider.php:23
Magento\Captcha\Model\Checkout\ConfigProvider\getRefreshUrl
getRefreshUrl()
Definition:
ConfigProvider.php:101
Magento\Captcha\Model\Checkout\ConfigProvider\getImageHeight
getImageHeight($formId)
Definition:
ConfigProvider.php:75
Magento\Captcha\Helper\Data
Definition:
Data.php:18
Magento\Captcha\Model\Checkout\ConfigProvider\isCaseSensitive
isCaseSensitive($formId)
Definition:
ConfigProvider.php:64