Пример #1
0
 protected function showComment(BaseHookRenderEvent $event)
 {
     list($ref, $refId) = $this->getParams($event);
     $eventDefinition = new CommentDefinitionEvent();
     $eventDefinition->setRef($ref)->setRefId($refId)->setCustomer($this->getCustomer())->setConfig(Comment::getConfig());
     $message = '';
     try {
         $this->dispatcher->dispatch(CommentEvents::COMMENT_GET_DEFINITION, $eventDefinition);
         $eventDefinition->setValid(true);
     } catch (InvalidDefinitionException $ex) {
         if ($ex->isSilent()) {
             return null;
         }
         $eventDefinition->setValid(false);
         $message = $ex->getMessage();
     } catch (\Exception $ex) {
         Tlog::getInstance()->debug($ex->getMessage());
         return null;
     }
     return $this->render("comment.html", ['definition' => $eventDefinition, 'message' => $message]);
 }
Пример #2
0
 protected function getDefinition($ref, $refId)
 {
     $eventDefinition = new CommentDefinitionEvent();
     $eventDefinition->setRef($ref)->setRefId($refId)->setCustomer($this->getSecurityContext()->getCustomerUser())->setConfig(Comment::getConfig());
     $this->dispatch(CommentEvents::COMMENT_GET_DEFINITION, $eventDefinition);
     return $eventDefinition;
 }