Extension:IntegratedProfiles/Hooks/IntegratedProfilesGetTabs
For more information about attaching hooks, see Manual:Hooks.
For examples of other extensions using this hook, see Category:IntegratedProfilesGetTabs extensions.
This hook allows extensions to mutate the lists of available tabs within IP. You can use this hook to register a tab, then use IntegratedProfilesRenderTab to render HTML under that tab. Intended for extensions, but can work elsewhere.
Details
[edit]&$tabs: Anarrayof registered tabs (see below).$profile
Tab schema
[edit][ 'id' => string, 'label' => string, 'weight' => int ]
Default
[edit]- About (weight = 10)
- Talk (weight = 15)
- Contributions (weight = 20)
Usage
[edit]/**
* Register a custom tab with IntegratedProfiles.
*
* @param list<array{id?:string,label?:string,weight?:int}> &$tabs
* @param array<string,mixed> $profile
*/
public function onIntegratedProfilesGetTabs( array &$tabs, array $profile ): void {
$tabs[] = [
'id' => 'customtab1',
'label' => 'My Tab',
'weight' => 14
];
}
In this example you can see how a tab should be registered. With a weight of 14, this custom tab would end up between the About (10) and Talk (15) tabs. However, it would not have any content yet, as that must be added separately with the IntegratedProfilesRenderTab hook.
Additionally, you can also use IntegratedProfilesGetTabs to remove default tabs, such as the default 'Talk' tab:
/**
* Remove a default tab from IntegratedProfiles.
*
* @param list<array{id?:string,label?:string,weight?:int}> &$tabs
* @param array<string,mixed> $profile
*/
public function onIntegratedProfilesGetTabs( array &$tabs, array $profile ): void {
$tabs = array_values( array_filter( $tabs, static function ( $tab ) {
return ( $tab['id'] ?? '' ) !== 'talk';
} ) );
}