public function addskinAction(Request $request)
    {

        // setup a fresh skin and module object
        $skin = new Skin();
        $module = new Module();

        if ($this->get('session')->has('module')) {
            // get the last module from the session to fill some additional defaults for the new skin
            $tmpModule = $this->get('session')->get('module');
            $skin->setModule($tmpModule->getName());
            $skin->setStyle($tmpModule->getStyle());
        }
        else {
            // fill it with some defaults
            $skin->setStyle('less');
        }

        // create form
        $form = $this->createForm(new SkinType(), $skin);

        if ($request->getMethod() == 'POST') {
            $form->bindRequest($request);

            if ($form->isValid()) {
                // create the skin in the filesystem
                try {
                    $moduleManager = $this->get('terrific.composer.module.manager');
                    $moduleManager->createSkin($skin);

                    $module->setStyle($skin->getStyle());
                    $module->setName($skin->getModule());
                    $this->get('session')->set('module', $module);
                    $this->get('session')->setFlash('notice', 'Skin ' . ucfirst($skin->getName()) . ' for Module ' . ucfirst($module->getName()) . ' created successfully');
                }
                catch (\Exception $e) {
                    $logger = $this->get('logger');
                    $logger->err($e->getMessage());

                    $this->get('session')->setFlash('notice', 'Skin could not be created: ' . $e->getMessage());
                }

                return $this->redirect($this->generateUrl('composer_add_skin'));
            }
        }

        return array('form' => $form->createView());
    }
public function addskinAction(Request $request)
    {

        // setup a fresh skin and module object
        $skin = new Skin();
        $module = new Module();

        if ($this->get('session')->has('module')) {
            // get the last module from the session to fill some additional defaults for the new skin
            $tmpModule = $this->get('session')->get('module');
            $skin->setModule($tmpModule->getName());
            $skin->setStyle($tmpModule->getStyle());
        }
        else {
            // fill it with some defaults
            $skin->setStyle('less');
        }

        // create form
        $form = $this->createForm(new SkinType(), $skin);

        if ($request->getMethod() == 'POST') {
            $form->bindRequest($request);

            if ($form->isValid()) {
                // create the skin in the filesystem
                try {
                    $moduleManager = $this->get('terrific.composer.module.manager');
                    $moduleManager->createSkin($skin);

                    $module->setStyle($skin->getStyle());
                    $module->setName($skin->getModule());
                    $this->get('session')->set('module', $module);
                    $this->get('session')->setFlash('notice', 'Skin ' . ucfirst($skin->getName()) . ' for Module ' . ucfirst($module->getName()) . ' created successfully');
                }
                catch (\Exception $e) {
                    $logger = $this->get('logger');
                    $logger->err($e->getMessage());

                    $this->get('session')->setFlash('notice', 'Skin could not be created: ' . $e->getMessage());
                }

                return $this->redirect($this->generateUrl('composer_add_skin'));
            }
        }

        return array('form' => $form->createView());
    }
public function addskinAction ( Request $ request ) { // setup a fresh skin and module object $ skin = new Skin ( ) ; $ module = new Module ( ) ; if ( $ this -> get ( 'session' ) -> has ( 'module' ) ) { // get the last module from the session to fill some additional defaults for the new skin $ tmpModule = $ this -> get ( 'session' ) -> get ( 'module' ) ; $ skin -> setModule ( $ tmpModule -> getName ( ) ) ; $ skin -> setStyle ( $ tmpModule -> getStyle ( ) ) ; } else { // fill it with some defaults $ skin -> setStyle ( 'less' ) ; } // create form $ form = $ this -> createForm ( new SkinType ( ) , $ skin ) ; if ( $ request -> getMethod ( ) == 'POST' ) { $ form -> bindRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { // create the skin in the filesystem try { $ moduleManager = $ this -> get ( 'terrific.composer.module.manager' ) ; $ moduleManager -> createSkin ( $ skin ) ; $ module -> setStyle ( $ skin -> getStyle ( ) ) ; $ module -> setName ( $ skin -> getModule ( ) ) ; $ this -> get ( 'session' ) -> set ( 'module' , $ module ) ; $ this -> get ( 'session' ) -> setFlash ( 'notice' , 'Skin ' . ucfirst ( $ skin -> getName ( ) ) . ' for Module ' . ucfirst ( $ module -> getName ( ) ) . ' created successfully' ) ; } catch ( \ Exception $ e ) { $ logger = $ this -> get ( 'logger' ) ; $ logger -> err ( $ e -> getMessage ( ) ) ; $ this -> get ( 'session' ) -> setFlash ( 'notice' , 'Skin could not be created: ' . $ e -> getMessage ( ) ) ; } return $ this -> redirect ( $ this -> generateUrl ( 'composer_add_skin' ) ) ; } } return array ( 'form' => $ form -> createView ( ) ) ; }
Adds a skin to the module.

@Route("/module/addskin", name="composer_add_skin")
@Template()

@param Request $request
@return Response
Adds a skin to the module .