Ejemplo n.º 1
0
 /**
  * This function is called when hook uses the automatic insert template.
  *
  *@param HookRenderEvent $event
  */
 public function insertTemplate(HookRenderEvent $event)
 {
     $code = $event->getName();
     if (array_key_exists($code, $this->templates)) {
         $templates = explode(';', $this->templates[$code]);
         foreach ($templates as $template) {
             list($type, $filepath) = $this->getTemplateParams($template);
             if ("render" === $type) {
                 $event->add($this->render($filepath, $event->getArguments()));
                 continue;
             }
             if ("dump" === $type) {
                 $event->add($this->render($filepath));
                 continue;
             }
             if ("css" === $type) {
                 $event->add($this->addCSS($filepath));
                 continue;
             }
             if ("js" === $type) {
                 $event->add($this->addJS($filepath));
                 continue;
             }
             if (method_exists($this, $type)) {
                 $this->{$type}($filepath, $event->getArguments());
             }
         }
     }
 }