Re-organise talks
This commit is contained in:
parent
e0e93e4fe5
commit
b60fb6038e
11 changed files with 192 additions and 12 deletions
5
src/format-talks-bundle/Resources/config/services.yml
Normal file
5
src/format-talks-bundle/Resources/config/services.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
services:
|
||||
app.twig.format_talks:
|
||||
class: 'App\FormatTalks\Twig\FormatTalksExtension'
|
||||
tags:
|
||||
- { name: twig.extension }
|
5
src/format-talks-bundle/composer.json
Normal file
5
src/format-talks-bundle/composer.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"require": {
|
||||
"tightenco/collect": "^5.4"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace App\FormatTalks\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
|
||||
class SculpinFormatTalksExtension extends Extension
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../../Resources/config'));
|
||||
$loader->load('services.yml');
|
||||
}
|
||||
}
|
7
src/format-talks-bundle/src/SculpinFormatTalksBundle.php
Normal file
7
src/format-talks-bundle/src/SculpinFormatTalksBundle.php
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace App\FormatTalks;
|
||||
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
|
||||
class SculpinFormatTalksBundle extends Bundle {}
|
34
src/format-talks-bundle/src/Twig/FormatTalksExtension.php
Normal file
34
src/format-talks-bundle/src/Twig/FormatTalksExtension.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace App\FormatTalks\Twig;
|
||||
|
||||
use Twig_Extension;
|
||||
use Twig_SimpleFilter;
|
||||
|
||||
class FormatTalksExtension extends Twig_Extension
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFilters()
|
||||
{
|
||||
return [
|
||||
new Twig_SimpleFilter('format_talks', [$this, 'formatTalks']),
|
||||
];
|
||||
}
|
||||
|
||||
public function formatTalks($talks)
|
||||
{
|
||||
return collect($talks)
|
||||
->sortBy('event.date')
|
||||
->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'format_talks';
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue