SMW Hooks/smwBrowseAction
From semantic-mediawiki.org
| Hook | smwBrowseAction |
| Description | Enables to add external information for the action=browse (Special:Browse) display |
| Introduced with | 1.9 |
| Deprecated with | still available |
| Keyword | Browse · Factbox · Action · Output · Context |
| Class | SMWFacts |
wfRunHooks( 'smwBrowseAction', array( IContextSource $context, array &$externalContent ) );) |
|
|
|
Register hook
$wgHooks['smwBrowseAction'][] = 'myExampleClass::onBrowseAction';
Implementation
public static function onBrowseAction( IContextSource $context, array &$facts ) {
// Fetch external data
$data = ...
// Check consistency
if ( $data !== '' ){
$newFacts = array();
// 'example-header-info' is being used as key and identifies the
// tab title object which should be created as system message
$newFacts['example-header-info'] = Html::rawElement(
'div', array(), $data
);
// Merge old and new content
$facts = array_merge ( $newFacts, $facts );
}
// Always return true in a hook
return true;
}
&$facts is an array with the key being an identifier for the tabs title (e.g. message text stored for 'example-header-info'). The array value is a string containing formatted information planned to be displayed on the tab.