File tree Expand file tree Collapse file tree 4 files changed +75
-5
lines changed
Configuration/TCA/Overrides Expand file tree Collapse file tree 4 files changed +75
-5
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+ declare (strict_types=1 );
3+
4+ namespace T3kit \themeT3kit \Utility ;
5+
6+ /**
7+ * Class TcaUtility
8+ * @package T3kit\themeT3kit\Utility
9+ */
10+ class TcaUtility
11+ {
12+ /**
13+ * Default slug replacements
14+ *
15+ * @var array
16+ */
17+ protected static $ slugReplacements = [
18+ 'ä ' => 'a ' ,
19+ 'å ' => 'a ' ,
20+ 'ö ' => 'o ' ,
21+ 'Å ' => 'a ' ,
22+ 'Ä ' => 'a ' ,
23+ 'Ö ' => 'o ' ,
24+ 'ø ' => 'o ' ,
25+ 'Ø ' => 'o '
26+ ];
27+
28+ /**
29+ * Set replacements for TCA slug field
30+ *
31+ * @param string $tableName TCA table name
32+ * @param string $slugFieldName Slug field name in TCA columns
33+ * @param array $additionalReplacements Additional replacements for default slug replacements
34+ */
35+ public static function setReplacementsForSlugField (
36+ string $ tableName ,
37+ string $ slugFieldName = 'slug ' ,
38+ array $ additionalReplacements = []
39+ ): void {
40+ if (isset ($ GLOBALS ['TCA ' ][$ tableName ]['columns ' ][$ slugFieldName ]['config ' ]['generatorOptions ' ])
41+ && is_array ($ GLOBALS ['TCA ' ][$ tableName ]['columns ' ][$ slugFieldName ]['config ' ]['generatorOptions ' ])
42+ ) {
43+ $ replacements = array_merge (static ::$ slugReplacements , $ additionalReplacements );
44+ $ generatorOptions = &$ GLOBALS ['TCA ' ][$ tableName ]['columns ' ][$ slugFieldName ]['config ' ]['generatorOptions ' ];
45+ $ generatorOptions ['replacements ' ] = array_merge (
46+ $ generatorOptions ['replacements ' ] ?? [],
47+ $ replacements
48+ );
49+ }
50+ }
51+ }
Original file line number Diff line number Diff line change 22defined ('TYPO3_MODE ' ) or die ();
33
44call_user_func (function () {
5- $ GLOBALS ['TCA ' ]['pages ' ]['columns ' ]['tx_themes_icon ' ]['config ' ] = array (
5+ $ GLOBALS ['TCA ' ]['pages ' ]['columns ' ]['tx_themes_icon ' ]['config ' ] = array (
66 'type ' => 'user ' ,
77 'userFunc ' => 'T3kit\themeT3kit\UserFunction\IconFontSelector->renderField ' ,
88 'cssFile ' => 'EXT:theme_t3kit/Resources/Public/IconFonts/style.css ' ,
1111 '0 ' => array ('None ' , '' , '' ),
1212 ),
1313 );
14+
15+ \T3kit \themeT3kit \Utility \TcaUtility::setReplacementsForSlugField (
16+ 'pages '
17+ );
1418});
Original file line number Diff line number Diff line change 1+ <?php
2+ defined ('TYPO3_MODE ' ) || die ('Access denied. ' );
3+
4+ call_user_func (function () {
5+ $ tableToField = [
6+ 'sys_category ' => 'slug ' ,
7+ 'tx_news_domain_model_tag ' => 'slug ' ,
8+ 'tx_news_domain_model_news ' => 'path_segment ' ,
9+ ];
10+
11+ foreach ($ tableToField as $ table => $ field ) {
12+ \T3kit \themeT3kit \Utility \TcaUtility::setReplacementsForSlugField (
13+ $ table ,
14+ $ field
15+ );
16+ }
17+ });
Original file line number Diff line number Diff line change 3434 'CGLcompliance_note ' => '' ,
3535 'constraints ' => array (
3636 'depends ' => array (
37- 'typo3 ' => '9.5.0-9.5.99 '
37+ 'typo3 ' => '9.5.0-9.5.99 ' ,
38+ 'news ' => '7.1.0-7.9.99 '
3839 ),
3940 'conflicts ' => array (
4041 ),
4142 'suggests ' => array (
4243 ),
4344 ),
44- '_md5_values_when_last_written ' => 'a:0:{} ' ,
4545);
46-
47- ?>
You can’t perform that action at this time.
0 commit comments