-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmg-new-helper.sublime-snippet
44 lines (40 loc) · 1.18 KB
/
mg-new-helper.sublime-snippet
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
<snippet>
<content><![CDATA[
namespace ${1:${TM_FILEPATH/(?:.*vendor\/)|(\/)?([^\/]+)(?=\/)|(?:\/[^\/]+\.php$)/(?1:\\$^N:$^N)/g}};
use Magento\Framework\App\Helper\AbstractHelper;
use Magento\Framework\App\Helper\Context;
use Magento\Store\Model\ScopeInterface;
/**
* ${2:${TM_FILENAME/(.+)\..+|.*/$1/:name}} class
*/
class ${2:${TM_FILENAME/(.+)\..+|.*/$1/:name}} extends AbstractHelper
{
/**
* ${2:${TM_FILENAME/(.+)\..+|.*/$1/:name}} constructor
*
* @param Context $context
*/
public function __construct(
Context \$context
) {
parent::__construct(\$context);
}
/**
* get admin config
*
* @param string \$path
* @param string \$scope
* @param string \$scopeId
* @return string|null
*/
public function getConfig(\$path, \$scope = ScopeInterface::SCOPE_STORE, \$scopeId = null)
{
return \$this->scopeConfig->getValue(\$path, \$scope, \$scopeId);
}
}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>mg-helper</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.php</scope>
</snippet>