Example #1
0
 /**
  * @param string $name
  * @param Closure $func
  * @param null|bool $takes_context
  *
  * @return Closure
  */
 public function simpleTag($name, $func, $takes_context = null)
 {
     $self_ = $this;
     $dec = function ($func) use($self_, $name, $takes_context) {
         list($params, $varargs, $varkw, $defaults) = py_inspect_getargspec($func);
         py_arr_insert($params, 0, array('parser', 'token'));
         $node_opts_ = array('func' => $func, 'takes_context' => $takes_context);
         $compile_func = function ($parser, $token) use($params, $varargs, $varkw, $defaults, $name, $takes_context, $node_opts_) {
             return DjaBase::genericTagCompiler($parser, $token, $params, $varargs, $varkw, $defaults, $name, $takes_context, 'SimpleNode', $node_opts_);
         };
         $self_->tag($name, $compile_func);
         return $func;
     };
     return $dec($func);
 }