Created
August 28, 2017 08:53
-
-
Save ahilles107/7383c710570ba4fd591c7a8331b09a1b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
namespace SWP\Extension; | |
use SWP\Parser\GimmeTokenParser; | |
class GimmeExtension extends \Twig_Extension | |
{ | |
/** | |
* Simple data loader implementation. | |
*/ | |
public function getLoader() | |
{ | |
// anonymous class (require php >= 7.0) | |
return new class() { | |
// load will return data passed to node | |
public function load($metaType, $parameters = []) | |
{ | |
return [ | |
'metaType' => $metaType, | |
'parameters' => $parameters, | |
]; | |
} | |
}; | |
} | |
/** | |
* Register token parser | |
* | |
* @return array | |
*/ | |
public function getTokenParsers() | |
{ | |
return [new GimmeTokenParser()]; | |
} | |
/** | |
* @return string | |
*/ | |
public function getName() | |
{ | |
return self::class; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment