Bundle/WidgetBundle/Model/WidgetManager.php
public function editWidgetStyle(Request $request, Widget $widget, View $view, $viewReference = null, $activeQuantum = null)
    {
        if ($request->getMethod() === 'POST') {
            $form = $this->widgetFormBuilder->buildWidgetStyleForm($widget, $viewReference, $activeQuantum);
            $form->handleRequest($request);

            if ($request->query->get('novalidate', false) === false && $form->isValid()) {
                if ($form->has('deleteBackground') && $form->get('deleteBackground')->getData()) {
                    // @todo: dynamic responsive key
                    foreach (['', 'XS', 'SM', 'MD', 'LG'] as $key) {
                        $widget->{'deleteBackground'.$key}();
                    }
                }
                $this->entityManager->flush();
                $params = [
                    'view'        => $view,
                    'success'     => true,
                    'html'        => $this->widgetRenderer->render($widget, $view),
                    'widgetId'    => $widget->getId(),
                    'viewCssHash' => $view->getCssHash(),
                ];
            } else {
                $template = ($request->query->get('novalidate', false) !== false) ? 'VictoireCoreBundle:Widget/Form/stylize:form.html.twig' : 'VictoireCoreBundle:Widget/Form:stylize.html.twig';
                $params = [
                    'success' => !$form->isSubmitted(),
                    'html'    => $this->templating->render(
                        $template,
                        [
                            'view'                     => $view,
                            'form'                     => $form->createView(),
                            'widget'                   => $widget,
                            'victoire_twig_responsive' => $this->twigResponsive,
                        ]
                    ),
                ];
            }
        } else {
            $widgets = $widget->getWidgetMap()->getWidgets();
            $forms = $this->widgetFormBuilder->renderQuantumStyleForms($viewReference, $widgets, $widget);
            $params = [
                'html' => $this->templating->render(
                    'VictoireCoreBundle:Widget/Form:stylize.html.twig',
                    [
                        'view'                     => $view,
                        'forms'                    => $forms,
                        'widget'                   => $widget,
                        'widgets'                  => $widgets,
                        'victoire_twig_responsive' => $this->twigResponsive,
                    ]
                ),
            ];
        }

        return new JsonResponse($params);
    }
public function editWidgetStyle(Request $request, Widget $widget, View $view, $viewReference = null, $activeQuantum = null)
    {
        if ($request->getMethod() === 'POST') {
            $form = $this->widgetFormBuilder->buildWidgetStyleForm($widget, $viewReference, $activeQuantum);
            $form->handleRequest($request);

            if ($request->query->get('novalidate', false) === false && $form->isValid()) {
                if ($form->has('deleteBackground') && $form->get('deleteBackground')->getData()) {
                    // @todo: dynamic responsive key
                    foreach (['', 'XS', 'SM', 'MD', 'LG'] as $key) {
                        $widget->{'deleteBackground'.$key}();
                    }
                }
                $this->entityManager->flush();
                $params = [
                    'view'        => $view,
                    'success'     => true,
                    'html'        => $this->widgetRenderer->render($widget, $view),
                    'widgetId'    => $widget->getId(),
                    'viewCssHash' => $view->getCssHash(),
                ];
            } else {
                $template = ($request->query->get('novalidate', false) !== false) ? 'VictoireCoreBundle:Widget/Form/stylize:form.html.twig' : 'VictoireCoreBundle:Widget/Form:stylize.html.twig';
                $params = [
                    'success' => !$form->isSubmitted(),
                    'html'    => $this->templating->render(
                        $template,
                        [
                            'view'                     => $view,
                            'form'                     => $form->createView(),
                            'widget'                   => $widget,
                            'victoire_twig_responsive' => $this->twigResponsive,
                        ]
                    ),
                ];
            }
        } else {
            $widgets = $widget->getWidgetMap()->getWidgets();
            $forms = $this->widgetFormBuilder->renderQuantumStyleForms($viewReference, $widgets, $widget);
            $params = [
                'html' => $this->templating->render(
                    'VictoireCoreBundle:Widget/Form:stylize.html.twig',
                    [
                        'view'                     => $view,
                        'forms'                    => $forms,
                        'widget'                   => $widget,
                        'widgets'                  => $widgets,
                        'victoire_twig_responsive' => $this->twigResponsive,
                    ]
                ),
            ];
        }

        return new JsonResponse($params);
    }
public function editWidgetStyle ( Request $ request , Widget $ widget , View $ view , $ viewReference = null , $ activeQuantum = null ) { if ( $ request -> getMethod ( ) === 'POST' ) { $ form = $ this -> widgetFormBuilder -> buildWidgetStyleForm ( $ widget , $ viewReference , $ activeQuantum ) ; $ form -> handleRequest ( $ request ) ; if ( $ request -> query -> get ( 'novalidate' , false ) === false && $ form -> isValid ( ) ) { if ( $ form -> has ( 'deleteBackground' ) && $ form -> get ( 'deleteBackground' ) -> getData ( ) ) { // @todo: dynamic responsive key foreach ( [ '' , 'XS' , 'SM' , 'MD' , 'LG' ] as $ key ) { $ widget -> { 'deleteBackground' . $ key } ( ) ; } } $ this -> entityManager -> flush ( ) ; $ params = [ 'view' => $ view , 'success' => true , 'html' => $ this -> widgetRenderer -> render ( $ widget , $ view ) , 'widgetId' => $ widget -> getId ( ) , 'viewCssHash' => $ view -> getCssHash ( ) , ] ; } else { $ template = ( $ request -> query -> get ( 'novalidate' , false ) !== false ) ? 'VictoireCoreBundle:Widget/Form/stylize:form.html.twig' : 'VictoireCoreBundle:Widget/Form:stylize.html.twig' ; $ params = [ 'success' => ! $ form -> isSubmitted ( ) , 'html' => $ this -> templating -> render ( $ template , [ 'view' => $ view , 'form' => $ form -> createView ( ) , 'widget' => $ widget , 'victoire_twig_responsive' => $ this -> twigResponsive , ] ) , ] ; } } else { $ widgets = $ widget -> getWidgetMap ( ) -> getWidgets ( ) ; $ forms = $ this -> widgetFormBuilder -> renderQuantumStyleForms ( $ viewReference , $ widgets , $ widget ) ; $ params = [ 'html' => $ this -> templating -> render ( 'VictoireCoreBundle:Widget/Form:stylize.html.twig' , [ 'view' => $ view , 'forms' => $ forms , 'widget' => $ widget , 'widgets' => $ widgets , 'victoire_twig_responsive' => $ this -> twigResponsive , ] ) , ] ; } return new JsonResponse ( $ params ) ; }
Edit widget style.

@param Request $request
@param Widget  $widget
@param View    $view
@param string  $viewReference
@param string  $activeQuantum

@return JsonResponse
Edit widget style .