-
Notifications
You must be signed in to change notification settings - Fork 4
/
Data.php
69 lines (61 loc) · 1.66 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
<?php
namespace BDC\SimpleNews\Helper;
use Magento\Framework\App\Helper\AbstractHelper;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\App\Helper\Context;
use Magento\Store\Model\ScopeInterface;
class Data extends AbstractHelper
{
const XML_PATH_ENABLED = 'simplenews/general/enable_in_frontend';
const XML_PATH_HEAD_TITLE = 'simplenews/general/head_title';
const XML_PATH_LASTEST_NEWS = 'simplenews/general/lastest_news_block_position';
/**
* @var \Magento\Framework\App\Config\ScopeConfigInterface
*/
protected $_scopeConfig;
/**
* @param Context $context
* @param ScopeConfigInterface $scopeConfig
*/
public function __construct(
Context $context,
ScopeConfigInterface $scopeConfig ) {
parent::__construct($context);
$this->_scopeConfig = $scopeConfig;
}
/**
* Check for module is enabled in frontend
*
* @return bool
*/
public function isEnabledInFrontend($store = null)
{
return $this->_scopeConfig->getValue(
self::XML_PATH_ENABLED,
ScopeInterface::SCOPE_STORE
);
}
/**
* Get head title for news list page
*
* @return string
*/
public function getHeadTitle()
{
return $this->_scopeConfig->getValue(
self::XML_PATH_HEAD_TITLE,
ScopeInterface::SCOPE_STORE
);
}
/**
* Get lastest news block position (Left, Right, Disabled)
*
* @return int
*/
public function getLastestNewsBlockPosition(){
return $this->_scopeConfig->getValue(
self::XML_PATH_LASTEST_NEWS,
ScopeInterface::SCOPE_STORE
);
}
}