Important
This extension is no longer maintained.
TwigElement is a Twig extension to manipulate HTML as object abstractions.
{# element(tag, content, attributes) #}
{{ element('input') }}
{# Outputs: <input type="" name=""> #}
{{ element('img').src('image.jpg') }}
{# Outputs: <img src="proxy.php?url=https%3A%2F%2Fgithub.com%2Fimage.jpg" alt=""> #}
{{ element('a', 'Example Link', { href: 'http://example.com/' }) }}
{# Outputs: <a href="proxy.php?url=http%3A%2F%2Fexample.com%2F">Example Link</a> #}Refer to the HtmlObject documentation for methods of element instances.