We will create search page for our custom component. First of all you will need to register a search page menu link for search sidebar. (Example Users, Groups, Your Name)
Please make sure you are using OSSN 7.2 at least
```
ossn_register_callback('ossn', 'init', function(){
//register a menu item on search page load
ossn_register_callback('page', 'load:search', function(){
//keep other search arguments in place
$args = OssnPagination::constructUrlArgs(array(
'type'
));
$type = 'mycustom';
ossn_register_menu_item('search', array(
'name' => $type, //must be unique
'text' => 'search:key', //this must be a langauge key not actual text as it handles itself ossn_print("search:key"),
'href' => "search?type={$type}{$args}",
));
});
});
```
Now we need to register page contents by using hook for search
```
ossn_register_callback('ossn', 'init', function(){
//register a menu item on search page load
ossn_register_callback('page', 'load:search', function(){
//keep other search arguments in place
$args = OssnPagination::constructUrlArgs(array(
'type'
));
$type = 'mycustom';
ossn_register_menu_item('search', array(
'name' => $type, //must be unique
'text' => 'search:key', //this must be a langauge key not actual text as it handles itself ossn_print("search:key"),
'href' => "search?type={$type}{$args}",
));
});
//adding search page handler
$type = "mycustom";
ossn_add_hook('search', "type:{$type}", function($hook, $type, $return, $params){
$query_string = $params['q'];
//return your page contents here
//example ossn_plugin_view('....
return $query_string;
});
});
```
Now adding a language file for search key. Create locale/ossn.en.php and add contents