Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Some\Bundle\Name\Twig;
- class ScriptWrapExtension extends \Twig_Extension
- {
- public function getFunctions()
- {
- return array(
- 'script_start' => new \Twig_Function_Method($this, 'startScriptTag', array('is_safe' => array('html'))),
- 'script_end' => new \Twig_Function_Method($this, 'endScriptTag', array('is_safe' => array('html'))),
- );
- }
- public function startScriptTag($id)
- {
- return sprintf('<script type="text/html" id="%s">', $id);
- }
- public function endScriptTag()
- {
- return sprintf('</script>');
- }
- public function getName()
- {
- return 'script_wrap_extension';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement