87 lines
1.8 KiB
Text
87 lines
1.8 KiB
Text
global !p
|
|
from mbutils import get_namespace
|
|
import os
|
|
|
|
def full_path(filename):
|
|
cwd = os.getcwd()
|
|
filepath = os.path.join(cwd, filename)
|
|
|
|
return os.path.dirname(filepath)
|
|
endglobal
|
|
|
|
snippet mcomponent
|
|
<?php
|
|
/**
|
|
* @copyright Copyright 2016 ${1:Redbox Digital}
|
|
*/
|
|
|
|
use Magento\\Framework\\Component\\ComponentRegistrar;
|
|
|
|
ComponentRegistrar::register(
|
|
ComponentRegistrar::${2:MODULE},
|
|
'${3:Redbox}_${4:Module}',
|
|
__DIR__
|
|
);
|
|
endsnippet
|
|
|
|
snippet mcontroller
|
|
<?php
|
|
/**
|
|
* @copyright Copyright 2016 ${1:Redbox Digital}
|
|
*/
|
|
|
|
namespace ${2:`!p snip.rv = get_namespace(full_path(path))`};
|
|
|
|
use Magento\\Framework\\App\\Action\\Action;
|
|
use Magento\\Framework\\App\\Action\\Context;
|
|
use Magento\\Framework\\Controller\\ResultFactory;
|
|
${3:// Use...}
|
|
|
|
class ${4:`!p snip.rv = snip.basename`} extends ${6:Action}${7: implements ${8:SomeInterface, OtherInterface}}
|
|
\{
|
|
/**
|
|
* @var ResultFactory
|
|
*/
|
|
private $resultFactory;
|
|
|
|
/**
|
|
* @param Context $context
|
|
* @param ResultFactory $resultFactory
|
|
*/
|
|
public function __construct(
|
|
Context $context,
|
|
ResultFactory $resultFactory
|
|
) \{
|
|
parent::__construct($context);
|
|
|
|
$this->resultFactory = $resultFactory;
|
|
\}
|
|
|
|
/**
|
|
* @return \Magento\Framework\Controller\ResultInterface
|
|
*/
|
|
public function execute()
|
|
\{
|
|
${0:// Implementation...}
|
|
\}
|
|
\}
|
|
endsnippet
|
|
|
|
snippet mblock
|
|
<?php
|
|
/**
|
|
* @copyright Copyright 2016 ${1:Redbox Digital}
|
|
*/
|
|
|
|
namespace ${2:`!p snip.rv = get_namespace(full_path(path))`};
|
|
|
|
use Magento\\Framework\\View\\Element\\Template;
|
|
use Magento\\Framework\\View\\Element\\Template\\Context;
|
|
${3:// Use...}
|
|
|
|
class ${4:`!p snip.rv = snip.basename`}extends ${6:Template}${7: implements ${8:SomeInterface, OtherInterface}}
|
|
\{
|
|
${0:// Implementation...}
|
|
\}
|
|
endsnippet
|
|
|