Bundle/WidgetBundle/Controller/WidgetController.php
public function stylizeAction(Request $request, Widget $widget, $viewReference, $quantum = null)
    {
        $view = $this->getViewByReferenceId($viewReference);
        $this->get('victoire_widget_map.builder')->build($view);

        try {
            $widgetView = $widget->getWidgetMap()->getView();
        } catch (WidgetMapNotFoundException $e) {
            return new JsonResponse([
                'success' => false,
                'message' => $e->getMessage(),
            ]);
        }

        if (!$view instanceof \Victoire\Bundle\TemplateBundle\Entity\Template) {
            $widgetViewReference = $this->get('victoire_view_reference.repository')
                ->getOneReferenceByParameters(['viewId' => $view->getId()]);
            $widgetView->setReference($widgetViewReference);
        }

        $this->get('victoire_core.current_view')->setCurrentView($view);

        try {
            $response = $this->get('widget_manager')->editWidgetStyle(
                $request,
                $widget,
                $view,
                $viewReference,
                $quantum
            );

            $this->congrat($this->get('translator')->trans('victoire.success.message', [], 'victoire'));
        } catch (Exception $ex) {
            $response = $this->getJsonReponseFromException($ex);
        }

        return $response;
    }
public function stylizeAction(Request $request, Widget $widget, $viewReference, $quantum = null)
    {
        $view = $this->getViewByReferenceId($viewReference);
        $this->get('victoire_widget_map.builder')->build($view);

        try {
            $widgetView = $widget->getWidgetMap()->getView();
        } catch (WidgetMapNotFoundException $e) {
            return new JsonResponse([
                'success' => false,
                'message' => $e->getMessage(),
            ]);
        }

        if (!$view instanceof \Victoire\Bundle\TemplateBundle\Entity\Template) {
            $widgetViewReference = $this->get('victoire_view_reference.repository')
                ->getOneReferenceByParameters(['viewId' => $view->getId()]);
            $widgetView->setReference($widgetViewReference);
        }

        $this->get('victoire_core.current_view')->setCurrentView($view);

        try {
            $response = $this->get('widget_manager')->editWidgetStyle(
                $request,
                $widget,
                $view,
                $viewReference,
                $quantum
            );

            $this->congrat($this->get('translator')->trans('victoire.success.message', [], 'victoire'));
        } catch (Exception $ex) {
            $response = $this->getJsonReponseFromException($ex);
        }

        return $response;
    }
public function stylizeAction ( Request $ request , Widget $ widget , $ viewReference , $ quantum = null ) { $ view = $ this -> getViewByReferenceId ( $ viewReference ) ; $ this -> get ( 'victoire_widget_map.builder' ) -> build ( $ view ) ; try { $ widgetView = $ widget -> getWidgetMap ( ) -> getView ( ) ; } catch ( WidgetMapNotFoundException $ e ) { return new JsonResponse ( [ 'success' => false , 'message' => $ e -> getMessage ( ) , ] ) ; } if ( ! $ view instanceof \ Victoire \ Bundle \ TemplateBundle \ Entity \ Template ) { $ widgetViewReference = $ this -> get ( 'victoire_view_reference.repository' ) -> getOneReferenceByParameters ( [ 'viewId' => $ view -> getId ( ) ] ) ; $ widgetView -> setReference ( $ widgetViewReference ) ; } $ this -> get ( 'victoire_core.current_view' ) -> setCurrentView ( $ view ) ; try { $ response = $ this -> get ( 'widget_manager' ) -> editWidgetStyle ( $ request , $ widget , $ view , $ viewReference , $ quantum ) ; $ this -> congrat ( $ this -> get ( 'translator' ) -> trans ( 'victoire.success.message' , [ ] , 'victoire' ) ) ; } catch ( Exception $ ex ) { $ response = $ this -> getJsonReponseFromException ( $ ex ) ; } return $ response ; }
Stylize a widget.

@param Request $request
@param Widget  $widget
@param int     $viewReference
@param string  $quantum

@throws Exception

@return JsonResponse

@Route("/victoire-dcms/widget/stylize/{id}/{viewReference}/{quantum}/", name="victoire_core_widget_stylize", defaults={"quantum":"a"}, options={"expose"=true})
Stylize a widget .