code/dispatcher/behavior/decoratable.php
protected function _beforeSend(DispatcherContext $context)
    {
        $response = $context->getResponse();

        if(!$response->isDownloadable())
        {
            foreach ($this->getDecorators() as $decorator)
            {
                //Get the decorator
                $config     = array('response' => array('content' => $response->getContent()));
                $controller = $this->getObject($decorator, $config);

                if(!$controller instanceof ControllerViewable)
                {
                    throw new \UnexpectedValueException(
                        'Decorator '.get_class($controller).' does not implement ControllerViewable'
                    );
                }

                //Set the view
                $parameters = array(
                    'language' => $this->getLanguage(),
                );

                if($response->isError()) {
                    $parameters['status'] = $response->getStatusCode();
                } else {
                    $parameters['component'] = $this->getController()->getIdentifier()->package;
                }

                $controller->getView()
                    ->setParameters($parameters)
                    ->getTemplate()->addFilter('decorator');

                //Set the response
                $response->setContent($controller->render());
            }
        }
    }
protected function _beforeSend(DispatcherContext $context)
    {
        $response = $context->getResponse();

        if(!$response->isDownloadable())
        {
            foreach ($this->getDecorators() as $decorator)
            {
                //Get the decorator
                $config     = array('response' => array('content' => $response->getContent()));
                $controller = $this->getObject($decorator, $config);

                if(!$controller instanceof ControllerViewable)
                {
                    throw new \UnexpectedValueException(
                        'Decorator '.get_class($controller).' does not implement ControllerViewable'
                    );
                }

                //Set the view
                $parameters = array(
                    'language' => $this->getLanguage(),
                );

                if($response->isError()) {
                    $parameters['status'] = $response->getStatusCode();
                } else {
                    $parameters['component'] = $this->getController()->getIdentifier()->package;
                }

                $controller->getView()
                    ->setParameters($parameters)
                    ->getTemplate()->addFilter('decorator');

                //Set the response
                $response->setContent($controller->render());
            }
        }
    }
protected function _beforeSend ( DispatcherContext $ context ) { $ response = $ context -> getResponse ( ) ; if ( ! $ response -> isDownloadable ( ) ) { foreach ( $ this -> getDecorators ( ) as $ decorator ) { //Get the decorator $ config = array ( 'response' => array ( 'content' => $ response -> getContent ( ) ) ) ; $ controller = $ this -> getObject ( $ decorator , $ config ) ; if ( ! $ controller instanceof ControllerViewable ) { throw new \ UnexpectedValueException ( 'Decorator ' . get_class ( $ controller ) . ' does not implement ControllerViewable' ) ; } //Set the view $ parameters = array ( 'language' => $ this -> getLanguage ( ) , ) ; if ( $ response -> isError ( ) ) { $ parameters [ 'status' ] = $ response -> getStatusCode ( ) ; } else { $ parameters [ 'component' ] = $ this -> getController ( ) -> getIdentifier ( ) -> package ; } $ controller -> getView ( ) -> setParameters ( $ parameters ) -> getTemplate ( ) -> addFilter ( 'decorator' ) ; //Set the response $ response -> setContent ( $ controller -> render ( ) ) ; } } }
Render the decorators

This method will also add the 'decorator' filter to the view and add following default parameters

- component: The name of the component being dispatched
- language: The language of the response
- status: The status code of the response

@param   DispatcherContext $context The active command context
@return  void
Render the decorators