78 lines
1.7 KiB
Plaintext
78 lines
1.7 KiB
Plaintext
snippet pf "Create a public function" b
|
|
public function $1()
|
|
{
|
|
return $this;
|
|
}
|
|
endsnippet
|
|
|
|
snippet ppf "Create a private function" b
|
|
public function $1()
|
|
{
|
|
return $this;
|
|
}
|
|
endsnippet
|
|
|
|
snippet ptf "Create a protected function" b
|
|
public function $1()
|
|
{
|
|
return $this;
|
|
}
|
|
endsnippet
|
|
|
|
snippet sf2:c "Create a symfony2 controller function" b
|
|
/**
|
|
* @param $request
|
|
* @return \Symfony\Bundle\FrameworkBundle\Controller\Response
|
|
*/
|
|
public function $1Action(Request $request)
|
|
{
|
|
return $this->defaultRender();
|
|
}
|
|
endsnippet
|
|
|
|
snippet page "Create trinity page"
|
|
<?php
|
|
|
|
`!p snip.rv = os.popen('/home/simon/bin/namespace ' + path).readline().strip()`
|
|
|
|
use Trinity\Bundle\ContentManagerBundle\Model\Page;
|
|
use Trinity\Bundle\ContentManagerBundle\Model\Block;
|
|
|
|
class `!p snip.rv = snip.basename` extends Page
|
|
{
|
|
public function __construct($template = '$1')
|
|
{
|
|
parent::__construct($template);
|
|
}
|
|
|
|
public function getConfiguration()
|
|
{
|
|
return $this->configuration
|
|
->setDefaultController('FooBarBundle:MyController:bob')
|
|
->setDefaultControllerClass('Foo\Bundle\BarBundle::bobAction')
|
|
->setBlock('title', 'Trinity\Bundle\ContentManagerBundle\Form\Type\BlockType')
|
|
->setBlock('content', 'Trinity\Bundle\ContentManagerBundle\Form\Type\TinymceAdvancedBlockType')
|
|
}
|
|
|
|
public function getBlockTitle()
|
|
{
|
|
return $this->getBlock('title');
|
|
}
|
|
|
|
public function getBlockTitle(Block $block)
|
|
{
|
|
return $this->setBlock($block);
|
|
}
|
|
|
|
public function getBlockContent()
|
|
{
|
|
return $this->getBlock('content');
|
|
}
|
|
|
|
public function setBlockContent(Block $block)
|
|
{
|
|
return $this->setBlock($block);
|
|
}
|
|
}
|
|
endsnippet
|