Created
January 11, 2014 00:38
-
-
Save danaketh/8365411 to your computer and use it in GitHub Desktop.
Just a basic Twig extension to support Yii ActiveForm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace danaketh/twig/ext; | |
use Yii; | |
use yii\helpers\Html; | |
use yii\widgets\ActiveForm; | |
class TwigActiveForm extends \Twig_Extension | |
{ | |
/** | |
* {@inheritdoc} | |
*/ | |
public function getName() | |
{ | |
return 'ActiveForm'; | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function getGlobals() | |
{ | |
return array( | |
); | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function getFunctions() | |
{ | |
return array( | |
"form_begin" => new \Twig_Function_Method($this, 'begin'), | |
"form_end" => new \Twig_Function_Method($this, 'end'), | |
); | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function getFilters() | |
{ | |
return array( | |
); | |
} | |
public function begin($args) | |
{ | |
return ActiveForm::begin($args); | |
} | |
public function end() | |
{ | |
ActiveForm::end(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment