Skip to content

Commit 9ca12a7

Browse files
committed
Fixing configuration-block tab names
1 parent 52ab119 commit 9ca12a7

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/Directive/ConfigurationBlockDirective.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function processSub(Parser $parser, ?Node $document, string $variable, st
2626
$language = $node->getLanguage() ?? 'Unknown';
2727

2828
$blocks[] = [
29-
'language' => strtoupper($language),
29+
'language' => $this->formatLanguageTab($language),
3030
'code' => $node->render(),
3131
];
3232
}
@@ -40,4 +40,21 @@ public function processSub(Parser $parser, ?Node $document, string $variable, st
4040

4141
return $parser->getNodeFactory()->createWrapperNode(null, $wrapperDiv, '</div>');
4242
}
43+
44+
/**
45+
* A hack to print exactly what we want in the tab of a configuration block
46+
*/
47+
private function formatLanguageTab(string $language): string
48+
{
49+
switch ($language) {
50+
case 'php-annotations':
51+
return 'Annotations';
52+
case 'xml':
53+
case 'yaml':
54+
case 'php':
55+
return strtoupper($language);
56+
default:
57+
return $language;
58+
}
59+
}
4360
}

0 commit comments

Comments
 (0)