Exemplo n.º 1
0
 protected function translate($message, array $params = array(), $catalogue = "RedKiteCmsBundle")
 {
     if (null === $this->translator) {
         $this->translator = $this->container->get('red_kite_cms.translator');
     }
     return $this->translator->translate($message, $params, $catalogue);
 }
 /**
  * @inheritdoc
  */
 public function getDefaultValue()
 {
     $message = "hypertext_block";
     if (null !== $this->translator) {
         $message = $this->translator->translate($message, array(), 'RedKiteCmsBundle');
     }
     return array('Content' => $message);
 }
Exemplo n.º 3
0
 /**
  * Handles RedKiteCmsExceptionInterface exceptions
  *
  * @param GetResponseForExceptionEvent $event
  */
 public function onKernelException(GetResponseForExceptionEvent $event)
 {
     $exception = $event->getException();
     if (!$exception instanceof RedKiteCmsExceptionInterface) {
         return;
     }
     $message = $exception->getMessage();
     $jsonMessage = json_decode($message, true);
     if (!is_array($jsonMessage)) {
         $jsonMessage = array('message' => $message);
     }
     $parameters = array('message' => '', 'parameters' => array(), 'domain' => 'RedKiteCmsBundle', 'locale' => null);
     $cleanedParameters = array_intersect_key($jsonMessage, $parameters);
     $parameters = array_merge($parameters, $cleanedParameters);
     $message = $this->translator->translate($parameters["message"], $parameters["parameters"], $parameters["domain"], $parameters["locale"]);
     $response = $this->templating->renderResponse('RedKiteCmsBundle:Dialog:dialog.html.twig', array('message' => $message));
     $response->setStatusCode(404);
     $event->setResponse($response);
 }