PHP Class Yosymfony\Spress\Core\ContentManager\Renderizer\TwigRenderizer

Author: Victor Puertas ([email protected])
Inheritance: implements Yosymfony\Spress\Core\ContentManager\Renderizer\RenderizerInterface
Mostra file Open project: spress/spress Class Usage Examples

Protected Properties

Property Type Description
$arrayLoader
$isLayoutsProcessed
$layoutExtension
$layouts
$twig

Public Methods

Method Description
__construct ( Twig_Environment $twig, Twig_Loader_Array $arrayLoader, array $layoutExtension ) Construct.
addInclude ( $id, $content, array $attributes = [] )
addLayout ( string $id, string $content, array $attributes = [] ) Add a new layout.
addTwigFilter ( string $name, callable $filter, array $options = [] ) Adds a new Twig filter.
addTwigFunction ( string $name, callable $function, array $options = [] ) Adds a new Twig function.
addTwigTag ( Twig_TokenParser $tokenParser ) Adds a new Twig tag.
addTwigTest ( string $name, callable $test, array $options = [] ) Adds a new Twig test.
clear ( )
renderBlocks ( string $id, string $content, array $attributes ) : string Render a blocks of content (layout NOT included).
renderPage ( string $id, string $content, string $layoutName, array $siteAttributes ) : string Render a page completely (layout included). The value of $content param will be placed at "page.content" attribute.

Protected Methods

Method Description
getLayoutAttribute ( array $attributes, string $contentName ) : string Get the value of layout attribute.
getLayoutNameWithNamespace ( string $name ) : string Gets the layout name with the namespace prefix.
getLayoutWithExtension ( $layoutName, $contentName )
processLayouts ( )

Method Details

__construct() public method

Construct.
public __construct ( Twig_Environment $twig, Twig_Loader_Array $arrayLoader, array $layoutExtension )
$twig Twig_Environment The Twig instance
$arrayLoader Twig_Loader_Array The loader
$layoutExtension array Extension availables for layouts. e.g: "html", "html.twig", "twig"

addInclude() public method

public addInclude ( $id, $content, array $attributes = [] )
$attributes array

addLayout() public method

Add a new layout.
public addLayout ( string $id, string $content, array $attributes = [] )
$id string The identifier of the layout. e.g: path
$content string The content of the layout
$attributes array The attributes of the layout. "layout" attribute has a special meaning

addTwigFilter() public method

Adds a new Twig filter.
See also: http://twig.sensiolabs.org/doc/advanced.html#filters Twig documentation
public addTwigFilter ( string $name, callable $filter, array $options = [] )
$name string Name of filter
$filter callable Filter implementation
$options array

addTwigFunction() public method

Adds a new Twig function.
See also: http://twig.sensiolabs.org/doc/advanced.html#functions Twig documentation
public addTwigFunction ( string $name, callable $function, array $options = [] )
$name string Name of filter
$function callable Filter implementation
$options array

addTwigTag() public method

Adds a new Twig tag.
See also: http://twig.sensiolabs.org/doc/advanced.html#tags Twig documentation
public addTwigTag ( Twig_TokenParser $tokenParser )
$tokenParser Twig_TokenParser

addTwigTest() public method

Adds a new Twig test.
See also: http://twig.sensiolabs.org/doc/advanced.html#tests Twig documentation
public addTwigTest ( string $name, callable $test, array $options = [] )
$name string Name of test
$test callable
$options array

clear() public method

public clear ( )

getLayoutAttribute() protected method

Get the value of layout attribute.
protected getLayoutAttribute ( array $attributes, string $contentName ) : string
$attributes array List of attributes
$contentName string The identifier of the content
return string

getLayoutNameWithNamespace() protected method

Gets the layout name with the namespace prefix.
protected getLayoutNameWithNamespace ( string $name ) : string
$name string The layout name
return string

getLayoutWithExtension() protected method

protected getLayoutWithExtension ( $layoutName, $contentName )

processLayouts() protected method

protected processLayouts ( )

renderBlocks() public method

Render a blocks of content (layout NOT included).
public renderBlocks ( string $id, string $content, array $attributes ) : string
$id string The path of the item
$content string The content
$attributes array The attributes for using inside the content
return string The block rendered

renderPage() public method

Render a page completely (layout included). The value of $content param will be placed at "page.content" attribute.
public renderPage ( string $id, string $content, string $layoutName, array $siteAttributes ) : string
$id string The path of the item
$content string The page content
$layoutName string The layout name
$siteAttributes array The attributes for using inside the content. "layout" attribute has a special meaning
return string The page rendered

Property Details

$arrayLoader protected_oe property

protected $arrayLoader

$isLayoutsProcessed protected_oe property

protected $isLayoutsProcessed

$layoutExtension protected_oe property

protected $layoutExtension

$layouts protected_oe property

protected $layouts

$twig protected_oe property

protected $twig