lithium\template\view\Renderer::__construct PHP Method

__construct() public method

Constructor.
public __construct ( array $config = [] ) : void
$config array Available configuration options are: - `view`: The `View` object associated with this renderer. - `strings`: String templates used by helpers. - `handlers`: An array of output handlers for string template inputs. - `request`: The `Request` object associated with this renderer and passed to the defined handlers. - `response`: The `Response` object associated with this renderer. - `context`: An array of the current rendering context data, including `content`, `title`, `scripts`, `head` and `styles`.
return void
    public function __construct(array $config = array())
    {
        $defaults = array('view' => null, 'strings' => array(), 'handlers' => array(), 'request' => null, 'response' => null, 'context' => array('content' => '', 'title' => '', 'scripts' => array(), 'styles' => array(), 'head' => array()));
        parent::__construct((array) $config + $defaults);
    }

Usage Example

Example #1
0
 /**
  * Constructor for this adapter - sets relevant default configurations for Twig to be used
  * when instantiating a new Twig_Environment and Twig_Loader_Filesystem.
  *
  * @param array $config Optional configuration directives.
  *        Please see http://www.twig-project.org/book/03-Twig-for-Developers for all
  *        available configuration keys and their description.
  *        There are 4 settings that is set
  *        - `cache`: Path to /resources/tmp/cache/templates/ where compiled templates will be stored
  *        - `auto_reload`: If Environment is not production, templates will be reloaded once edited
  *        - `base_template_class`: Overriden to the Template adapter, be carefull with changing this
  *        - `autoescape`: Set to false because the way we inject content is with full html that should not be escaped
  * @return void
  */
 public function __construct(array $config = array())
 {
     /**
      * TODO Change hardcoded LITHIUM_APP_PATH to be dynamic
      */
     $defaults = array('cache' => LITHIUM_APP_PATH . '/resources/tmp/cache/templates', 'auto_reload' => !Environment::is('production'), 'base_template_class' => 'li3_twig\\template\\view\\adapter\\Template', 'autoescape' => false);
     parent::__construct($config + $defaults);
 }
All Usage Examples Of lithium\template\view\Renderer::__construct