Ссылка на коммит в подвале

Требует установку гит-хуков
This commit is contained in:
2022-09-12 22:34:05 +08:00
parent acf1f8083f
commit 585392b295
8 changed files with 39 additions and 18 deletions

View File

@@ -13,6 +13,7 @@ class TwigFunctions extends AbstractExtension
{
return [
new TwigFunction('config', [$this, 'config']),
new TwigFunction('commit', [$this, 'commit']),
new TwigFunction('is_file', [$this, 'is_file']),
new TwigFunction('base_url', [$this, 'base_url']),
];
@@ -23,6 +24,11 @@ class TwigFunctions extends AbstractExtension
return config($key, $default);
}
public function commit(): string
{
return file_get_contents(root_path('commit'));
}
public function base_url(string $path = ''): string
{
return base_url($path);

View File

@@ -62,7 +62,12 @@
<a href="{{ base_url('faq') }}">FAQ</a>&nbsp;|&nbsp;<a
href="https://github.com/anthonyaxenov/iptv">GitHub</a>&nbsp;|&nbsp;<a
href="https://git.axenov.dev/anthony/iptv">Gitea</a>&nbsp;|&nbsp;<a
href="https://axenov.dev">axenov.dev</a>
href="https://axenov.dev">axenov.dev</a><br>
<span class="small text-muted">
commit&nbsp;<a class="text-muted" target="_blank"
href="https://github.com/anthonyaxenov/iptv/commit/{{ commit() }}"
>{{ commit()[:8] }}</a>
</span>
</footer>
</div>
{% if is_file("custom/custom.twig") %}