-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathData.php
executable file
·123 lines (113 loc) · 2.78 KB
/
Data.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
/**
* MagePrince
*
* NOTICE OF LICENSE
*
* This source file is subject to the mageprince.com license that is
* available through the world-wide-web at this URL:
* https://mageprince.com/end-user-license-agreement
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category MagePrince
* @package Mageprince_Faq
* @copyright Copyright (c) MagePrince (https://mageprince.com/)
* @license https://mageprince.com/end-user-license-agreement
*/
namespace Mageprince\Faq\Helper;
use Magento\Customer\Model\Session as CustomerSession;
use Magento\Framework\App\Helper\AbstractHelper;
use Magento\Framework\App\Helper\Context;
use Magento\Store\Model\ScopeInterface;
use Mageprince\Faq\Model\Config\DefaultConfig;
use Magento\Framework\App\Http\Context as AuthContext;
class Data extends AbstractHelper
{
/**
* @var CustomerSession
*/
protected $customerSession;
/**
* @var AuthContext
*/
protected $authContext;
/**
* Data constructor.
*
* @param Context $context
* @param CustomerSession $customerSession
* @param AuthContext $authContext
*/
public function __construct(
Context $context,
CustomerSession $customerSession,
AuthContext $authContext
) {
$this->customerSession = $customerSession;
$this->authContext = $authContext;
parent::__construct($context);
}
/**
* Get config path
*
* @param string $config
* @return mixed
*/
public function getConfig($config)
{
return $this->scopeConfig->getValue(
$config,
ScopeInterface::SCOPE_STORE
);
}
/**
* Get faq url
*
* @return string
*/
public function getFaqUrl()
{
return $this->scopeConfig->getValue(DefaultConfig::FAQ_URL_CONFIG_PATH);
}
/**
* Get current customer group id
*
* @return int
*/
public function getCustomerGroupId()
{
$customerGroup = 0;
$isLoggedIn = $this->authContext->getValue(\Magento\Customer\Model\Context::CONTEXT_AUTH);
if ($isLoggedIn) {
$customerGroup = $this->customerSession->getCustomer()->getGroupId();
}
return $customerGroup;
}
/**
* Check is block data
*
* @param string $data
* @return bool
*/
public function checkBlockData($data)
{
if ($data == '1') {
return true;
} elseif ($data == '0') {
return false;
}
}
/**
* Check is module enabled
*
* @return bool
*/
public function isEnable()
{
return $this->scopeConfig->getValue(DefaultConfig::CONFIG_PATH_IS_ENABLE);
}
}