-
- // Swap out the deletedcontribs link for our contribs one
- $tools = wfArrayInsertAfter( $tools, $insert, 'deletedcontribs' );
- unset( $tools['deletedcontribs'] );
+ if ( isset( $tools['deletedcontribs'] ) ) {
+ // Swap out the deletedcontribs link for our contribs one
+ $tools = wfArrayInsertAfter(
+ $tools, [ 'contribs' => $contributionsLink ], 'deletedcontribs' );
+ unset( $tools['deletedcontribs'] );
+ } else {
+ $tools['contribs'] = $contributionsLink;
+ }