@@ -48,23 +48,35 @@ public function load(array $configs, ContainerBuilder $container): void
48
48
Typo3DocsThemeSettings::class,
49
49
[
50
50
'$settings ' => [
51
- 'typo3_version ' => $ configs[ 1 ][ 'typo3_version ' ] ?? 'main ' ,
52
- 'edit_on_github ' => $ configs[ 1 ][ 'edit_on_github ' ] ?? '' ,
53
- 'edit_on_github_branch ' => $ configs[ 1 ][ 'edit_on_github_branch ' ] ?? 'main ' ,
54
- 'how_to_edit ' => $ configs[ 1 ][ 'how_to_edit ' ] ?? 'https://docs.typo3.org/m/typo3/docs-how-to-document/main/en-us/WritingDocsOfficial/GithubMethod.html ' ,
55
- 'interlink_shortcode ' => $ configs[ 1 ][ 'interlink_shortcode ' ] ?? '' ,
56
- 'copy_sources ' => $ configs[ 1 ][ 'copy_sources ' ] ?? 'true ' ,
57
- 'project_home ' => $ configs[ 1 ][ 'project_home ' ] ?? '' ,
58
- 'project_contact ' => $ configs[ 1 ][ 'project_contact ' ] ?? '' ,
59
- 'project_repository ' => $ configs[ 1 ][ 'project_repository ' ] ?? '' ,
60
- 'project_issues ' => $ configs[ 1 ][ 'project_issues ' ] ?? '' ,
51
+ 'typo3_version ' => $ this -> getConfigValue ( $ configs, 'typo3_version ' , 'main ' ) ,
52
+ 'edit_on_github ' => $ this -> getConfigValue ( $ configs, 'edit_on_github ' , '' ) ,
53
+ 'edit_on_github_branch ' => $ this -> getConfigValue ( $ configs, 'edit_on_github_branch ' , 'main ' ) ,
54
+ 'how_to_edit ' => $ this -> getConfigValue ( $ configs, 'how_to_edit ' , 'https://docs.typo3.org/m/typo3/docs-how-to-document/main/en-us/WritingDocsOfficial/GithubMethod.html ' ) ,
55
+ 'interlink_shortcode ' => $ this -> getConfigValue ( $ configs, 'interlink_shortcode ' , '' ) ,
56
+ 'copy_sources ' => $ this -> getConfigValue ( $ configs, 'copy_sources ' , 'true ' ) ,
57
+ 'project_home ' => $ this -> getConfigValue ( $ configs, 'project_home ' , '' ) ,
58
+ 'project_contact ' => $ this -> getConfigValue ( $ configs, 'project_contact ' , '' ) ,
59
+ 'project_repository ' => $ this -> getConfigValue ( $ configs, 'project_repository ' , '' ) ,
60
+ 'project_issues ' => $ this -> getConfigValue ( $ configs, 'project_issues ' , '' ) ,
61
61
],
62
62
],
63
63
);
64
64
$ container ->setDefinition (Typo3DocsThemeSettings::class, $ definition );
65
65
}
66
66
}
67
67
68
+ /**
69
+ * @param array<int, mixed> $configs
70
+ * @return string
71
+ */
72
+ private function getConfigValue (array $ configs , string $ key , string $ default ): string
73
+ {
74
+ if (!is_array ($ configs [1 ] ?? false ) || !isset ($ configs [1 ][$ key ]) || !is_scalar ($ configs [1 ][$ key ])) {
75
+ return $ default ;
76
+ }
77
+ return strval ($ configs [1 ][$ key ]);
78
+ }
79
+
68
80
public function prepend (ContainerBuilder $ container ): void
69
81
{
70
82
$ container ->prependExtensionConfig ('guides ' , [
0 commit comments