mirror of
https://github.com/quentin-g-dev/afup.git
synced 2026-03-26 02:02:15 +01:00
35 lines
948 B
PHP
35 lines
948 B
PHP
<?php
|
|
|
|
namespace AppBundle\Twig;
|
|
|
|
use AppBundle\Offices\OfficesCollection;
|
|
|
|
class OfficesExtension extends \Twig_Extension
|
|
{
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function getFunctions()
|
|
{
|
|
return [
|
|
new \Twig_SimpleFunction('office_name', function ($code) {
|
|
$collection = new OfficesCollection();
|
|
return $collection->findByCode($code)['label'];
|
|
}),
|
|
new \Twig_SimpleFunction('office_logo', function ($code) {
|
|
$collection = new OfficesCollection();
|
|
return $collection->findByCode($code)['logo_url'];
|
|
}),
|
|
new \Twig_SimpleFunction('office_meetup_urlname', function ($code) {
|
|
$collection = new OfficesCollection();
|
|
return $collection->findByCode($code)['meetup_urlname'];
|
|
}),
|
|
];
|
|
}
|
|
|
|
public function getName()
|
|
{
|
|
return 'offices';
|
|
}
|
|
}
|