Skip to content

Commit c1eefb9

Browse files
committed
added to Admin Links (fixes #3)
1 parent db48730 commit c1eefb9

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

extension.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@
4747
},
4848
"AutoloadClasses": {
4949
"CloseAccount": "includes/specials/SpecialCloseAccount.php",
50-
"EditAccount": "includes/specials/SpecialEditAccount.php"
50+
"EditAccount": "includes/specials/SpecialEditAccount.php",
51+
"EditAccountHooks": "includes/Hooks.php"
52+
},
53+
"Hooks": {
54+
"AdminLinks": "EditAccountHooks::addToAdminLinks"
5155
},
5256
"ResourceModules": {
5357
"ext.editAccount": {

includes/Hooks.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
class EditAccountHooks {
4+
/**
5+
* Add a link to 'Special:ApprovedPages' to the page
6+
* 'Special:AdminLinks', defined by the Admin Links extension.
7+
*/
8+
public static function addToAdminLinks( $admin_links_tree ): bool {
9+
$general_section = $admin_links_tree->getSection( wfMessage( 'adminlinks_users' )->text() );
10+
$extensions_row = $general_section->getRow( 'main' );
11+
if ( $extensions_row === null ) {
12+
$extensions_row = new ALRow( 'main' );
13+
$general_section->addRow( $extensions_row );
14+
}
15+
$extensions_row->addItem( ALItem::newFromSpecialPage( 'EditAccount' ), 'Userrights' );
16+
return true;
17+
}
18+
}

0 commit comments

Comments
 (0)