Skip to content

Commit b918de4

Browse files
committed
allow forcing language of downloaded nav fragments
1 parent 8e0cc3c commit b918de4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Extensions/Twig/GetFromFrontendExtension.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ public function getFunctions(): array
4040
*
4141
* @return string
4242
*/
43-
private function fromFrontend(string $path, string $lang = 'en'): string
43+
private function fromFrontend(string $path, ?string $lang = 'en'): string
4444
{
4545
$content = '';
4646
try {
47-
$response = $this->client->request('GET', $this->baseUrl . ($lang === 'en' ? '' : '/' . $lang) . $path);
47+
$response = $this->client->request('GET', $this->baseUrl . ((!$lang || $lang === 'en') ? '' : '/' . $lang) . $path);
4848

4949
$statusCode = $response->getStatusCode();
5050

@@ -56,22 +56,22 @@ private function fromFrontend(string $path, string $lang = 'en'): string
5656
return $content;
5757
}
5858

59-
public function globalNav(string $lang = 'en'): string
59+
public function globalNav(?string $lang = 'en'): string
6060
{
6161
return $this->fromFrontend('/_fragments/global-nav/', $lang);
6262
}
6363

64-
public function langNav(string $lang = 'en'): string
64+
public function langNav(?string $lang = 'en'): string
6565
{
6666
return $this->fromFrontend('/_fragments/lang-nav/', $lang);
6767
}
6868

69-
public function footer(string $lang = 'en'): string
69+
public function footer(?string $lang = 'en'): string
7070
{
7171
return $this->fromFrontend('/_fragments/footer/', $lang);
7272
}
7373

74-
public function commonHead(string $lang = 'en'): string
74+
public function commonHead(?string $lang = 'en'): string
7575
{
7676
return $this->fromFrontend('/_fragments/common-head/', $lang);
7777
}

0 commit comments

Comments
 (0)