xaraya/twig

Use Twig template engine with Xaraya

Installs: 14

Dependents: 0

Suggesters: 2

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Language:Twig

Type:xaraya-module

2.5.4 2024-09-20 10:15 UTC

This package is auto-updated.

Last update: 2024-12-20 10:49:45 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.

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.