dtkahl/twig-renderable-extension

1.0.0 2017-08-18 11:51 UTC

This package is auto-updated.

Last update: 2024-04-29 03:44:27 UTC


README

This package adds a custom render-tag to Twig. This tag automatically renders an instance of a class that implements the interface TwigRenderableInterface. This is done by including the twig-template which is returned from $instance->getTemplate() with the data which got returned from $instance->getRenderData().

{% render instance %}

Dependencies

  • PHP >=7.0.0
  • twig\twig ^2.0

Installation

Install with Composer:

composer require dtkahl/twig-renderable-extension

Register the extension to the Twig instance:

use \Dtkahl\FormBuilder|TwigRenderableExtension;
$twig->addExtension(new TwigRenderableExtension);