Skip to content

Commit

Permalink
cleanup(twig): removed harcoded version
Browse files Browse the repository at this point in the history
  • Loading branch information
COil committed Dec 12, 2023
1 parent b757535 commit d7208d9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
1 change: 0 additions & 1 deletion config/packages/twig.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
twig:
default_path: '%kernel.project_dir%/templates'
globals:
version: '%version%'
brand: '%brand%'
brand_html: '%brand_html%'

Expand Down
1 change: 0 additions & 1 deletion config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
parameters:
brand: 'MicroSymfony'
brand_html: '<b>Micro</b>Symfony 🎶'
version: '7.0.1'

services:
# default configuration for services in *this* file
Expand Down
25 changes: 25 additions & 0 deletions src/Twig/Extension/EnvExtension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

declare(strict_types=1);

namespace App\Twig\Extension;

use Symfony\Component\HttpKernel\Kernel;
use Twig\Extension\AbstractExtension;
use Twig\Extension\GlobalsInterface;

/**
* Env related stuff.
*/
final class EnvExtension extends AbstractExtension implements GlobalsInterface
{
/**
* @return array<string,string>
*/
public function getGlobals(): array
{
return [
'version' => Kernel::VERSION,
];
}
}

0 comments on commit d7208d9

Please sign in to comment.