/grav-plugin-twig-clone

Provides clone function to twig templates.

Primary LanguagePHP

Grav twig-clone Plugin

twig-clone is a Grav plugin to copy objects within clone templates, originally implemented for Drupal by @GroovyCarrot.

Features

Allows you to copy an object (so as not to alter the original), from within your Twig template:

{% set attributes_copy = clone(attributes) %}

Install

As this plugin has not been included in the Grav repositories yet, you have to install it manually.

From within your plugins directory:

git clone https://github.com/paulcmal/grav-plugin-twig-clone
mv grav-plugin-twig-clone twig-clone

Acknowledgements

This Twig extension was originally developped by @GroovyCarrot as a Drupal plugin.

I merely rewrapped his code as a Grav plugin.