Skip to content

Commit b41eb64

Browse files
malbertsclaude
andcommitted
Consolidate RedHerb's NeoWikiGetFrontendModules handlers
RedHerb had two classes implementing NeoWikiGetFrontendModulesHook: RedHerbFrontendHook (added with the Color frontend) and RedHerbFrontendModulesHook (added later with the sidebar dialogs). The split was incidental — a later PR added a new file instead of editing the existing one — and there's no functional reason for two classes when one handler can append all three modules. Merge the body of RedHerbFrontendHook into RedHerbFrontendModulesHook and remove the redundant class and its extension.json registration. No behavior change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent d4dfe5b commit b41eb64

4 files changed

Lines changed: 5 additions & 24 deletions

File tree

tests/RedHerb/extension.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,14 @@
3131

3232
"Hooks": {
3333
"NeoWikiRegistration": "ProfessionalWiki\\RedHerb\\RedHerbHooks::onNeoWikiRegistration",
34-
"NeoWikiGetFrontendModules": [ "RedHerbFrontendModulesHook", "RedHerbFrontendHook" ],
34+
"NeoWikiGetFrontendModules": "RedHerbFrontendModulesHook",
3535
"SidebarBeforeOutput": "RedHerbSidebarHook"
3636
},
3737

3838
"HookHandlers": {
3939
"RedHerbFrontendModulesHook": {
4040
"class": "ProfessionalWiki\\RedHerb\\RedHerbFrontendModulesHook"
4141
},
42-
"RedHerbFrontendHook": {
43-
"class": "ProfessionalWiki\\RedHerb\\RedHerbFrontendHook"
44-
},
4542
"RedHerbSidebarHook": {
4643
"class": "ProfessionalWiki\\RedHerb\\RedHerbSidebarHook"
4744
}

tests/RedHerb/src/RedHerbFrontendHook.php

Lines changed: 0 additions & 17 deletions
This file was deleted.

tests/RedHerb/src/RedHerbFrontendModulesHook.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
class RedHerbFrontendModulesHook implements NeoWikiGetFrontendModulesHook {
1212

1313
public function onNeoWikiGetFrontendModules( array &$modules, OutputPage $out, Skin $skin ): void {
14+
$modules[] = 'ext.redherb';
1415
$modules[] = 'ext.redherb-create-child';
1516
$modules[] = 'ext.redherb-edit-main-subject';
1617
}

tests/phpunit/RedHerb/RedHerbFrontendModulesHookTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
class RedHerbFrontendModulesHookTest extends TestCase {
1616

17-
public function testAddsRedHerbDialogModules(): void {
17+
public function testAddsRedHerbModules(): void {
1818
$modules = [];
1919
$hook = new RedHerbFrontendModulesHook();
2020

@@ -25,7 +25,7 @@ public function testAddsRedHerbDialogModules(): void {
2525
);
2626

2727
$this->assertSame(
28-
[ 'ext.redherb-create-child', 'ext.redherb-edit-main-subject' ],
28+
[ 'ext.redherb', 'ext.redherb-create-child', 'ext.redherb-edit-main-subject' ],
2929
$modules
3030
);
3131
}
@@ -41,7 +41,7 @@ public function testPreservesExistingModules(): void {
4141
);
4242

4343
$this->assertSame(
44-
[ 'ext.preexisting', 'ext.redherb-create-child', 'ext.redherb-edit-main-subject' ],
44+
[ 'ext.preexisting', 'ext.redherb', 'ext.redherb-create-child', 'ext.redherb-edit-main-subject' ],
4545
$modules
4646
);
4747
}

0 commit comments

Comments
 (0)