xaraya/twig

Use Twig template engine with Xaraya

Installs: 2

Dependents: 0

Suggesters: 1

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Language:Twig

Type:xaraya-module

2.5.1 2024-04-06 20:42 UTC

This package is auto-updated.

Last update: 2024-04-14 13:24:12 UTC


README

Xaraya has been using Blocklayout for templates since the early days. The Twig bridge included in Xaraya core allows you to use Twig-based templates to generate output in Xaraya if needed, with a number of Xaraya-specific extensions.

This repository contains the Twig templates converted from Blocklayout for different modules, blocks, properties and themes.

Twig Namespaces

In general modules templates are mapped to their equivalent @modname namespace. To avoid overlap (with the themes or blocks modules), themes, properties and blocks templates use the singular equivalent @theme, @property and @block namespace.

Component Namespace Templates
Module @base html/code/modules/base
Module @dynamicdata html/code/modules/dynamicdata
Module ... ...
Theme @theme html/themes
Property @property html/code/properties
Block @block html/code/blocks

Xaraya Twig Extensions

Since Blocklayout allows significant PHP processing in templates and Twig deliberately does not, many of the common API calls to static core methods have been made available as Twig functions. Similarly, most Blocklayout and Xaraya tags have their equivalent Twig functions too.

This made translation of all templates from Blocklayout to Twig feasible, but for future template development we highly recommend to prepare all needed template variables up-front in the PHP functions, and then pass them along to the template as intended.