for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PiedWeb\RenderAttributes;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
/**
* Transform an array in html tag attributes
* Twig Extension
* PSR-2 Coding Style, PSR-4 Autoloading.
*
* @author Robin <[email protected]> https://piedweb.com
* @see https://github.com/PiedWeb/render-html-attributes
* @since File available since 2018.11.12
*/
class TwigExtension extends AbstractExtension
{
use AttributesTrait;
public function getFunctions()
return [
new TwigFunction('mergeAttr', [self::class, 'mergeAndMapAttributes'], ['is_safe' => ['html']]),
new TwigFunction('attr', [self::class, 'mapAttributes'], ['is_safe' => ['html']]),
];
}