Add SponsorsExtension

This commit is contained in:
Oliver Davies 2019-05-20 22:13:09 +01:00
parent d0774d1408
commit e3ba387f86
2 changed files with 30 additions and 0 deletions

View file

@ -1 +1,5 @@
services: services:
twig.app.sponsors:
class: 'App\Sponsors\TwigExtension\SponsorsExtension'
tags:
- { name: twig.extension }

View file

@ -0,0 +1,26 @@
<?php
namespace App\Sponsors\TwigExtension;
use App\Sponsors\Model\Sponsor;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
class SponsorsExtension extends AbstractExtension
{
public function getName()
{
return 'app.sponsors';
}
public function getFunctions()
{
return [
new TwigFunction('getSponsors', [$this, 'getSponsors'])
];
}
public function getSponsors(array $sponsorData, string $level): array
{
}
}