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

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

Protected Properties

Свойство Type Description
$arrayLoader
$isLayoutsProcessed
$layoutExtension
$layouts
$twig

Méthodes publiques

Méthode 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.

Méthodes protégées

Méthode 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 méthode

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 méthode

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

addLayout() public méthode

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 méthode

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 méthode

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 méthode

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 méthode

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 méthode

public clear ( )

getLayoutAttribute() protected méthode

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
Résultat string

getLayoutNameWithNamespace() protected méthode

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

getLayoutWithExtension() protected méthode

protected getLayoutWithExtension ( $layoutName, $contentName )

processLayouts() protected méthode

protected processLayouts ( )

renderBlocks() public méthode

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
Résultat string The block rendered

renderPage() public méthode

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
Résultat 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