-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Expand file tree
/
Copy pathTabs.php
More file actions
113 lines (100 loc) · 2.76 KB
/
Tabs.php
File metadata and controls
113 lines (100 loc) · 2.76 KB
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
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* System configuration tabs block
*
* @method setTitle(string $title)
*/
namespace Magento\Config\Block\System\Config;
/**
* @api
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @since 100.0.2
*/
class Tabs extends \Magento\Backend\Block\Widget
{
/**
* @var \Magento\Config\Model\Config\Structure\Element\Iterator
*/
protected $_tabs;
/**
* Block template filename
*
* @var string
*/
protected $_template = 'Magento_Config::system/config/tabs.phtml';
/**
* Currently selected section id
*
* @var string
*/
protected $_currentSectionId;
/**
* Current website code
*
* @var string
*/
protected $_websiteCode;
/**
* Current store code
*
* @var string
*/
protected $_storeCode;
/**
* @var \Magento\Backend\Helper\Data
*/
protected $_backendHelper;
/**
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Config\Model\Config\Structure $configStructure
* @param \Magento\Backend\Helper\Data $backendHelper
* @param array $data
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Config\Model\Config\Structure $configStructure,
\Magento\Backend\Helper\Data $backendHelper,
array $data = []
) {
$this->_backendHelper = $backendHelper;
parent::__construct($context, $data);
$this->_tabs = $configStructure->getTabs();
$this->setId('system_config_tabs');
$this->setTitle(__('Configuration'));
$this->_currentSectionId = $this->getRequest()->getParam('section');
$this->_backendHelper->addPageHelpUrl($this->getRequest()->getParam('section') . '/');
}
/**
* Get all tabs
*
* @return \Magento\Config\Model\Config\Structure\Element\Iterator
*/
public function getTabs()
{
return $this->_tabs;
}
/**
* Retrieve section url by section id
*
* @param \Magento\Config\Model\Config\Structure\Element\Section $section
* @return string
*/
public function getSectionUrl(\Magento\Config\Model\Config\Structure\Element\Section $section)
{
return $this->getUrl('*/*/*', ['_current' => true, 'section' => $section->getId()]);
}
/**
* Check whether section should be displayed as active
*
* @param \Magento\Config\Model\Config\Structure\Element\Section $section
* @return bool
*/
public function isSectionActive(\Magento\Config\Model\Config\Structure\Element\Section $section)
{
return $section->getId() == $this->_currentSectionId;
}
}