When my extension is installed i want the menu to be generated and added to the CiviCRM main menu as a new tab ie a main menu with subs under it so the user do not have to manualy do that, what is the best way of doing that? can that be done in my extension before given to be installed and tested? If possible, I need some pointers to that solution.
1 Answer
It's strongly recommended you use the navigationMenu hook in your extension.php file.
function civisocial_civicrm_navigationMenu( &$params ) {
$maxKey = ( max( array_keys($params) ) );
$params[$maxKey+1] = array (
'attributes' => array (
'label' => 'Civisocial',
'name' => 'Civisocial',
'url' => null,
'permission' => null,
'operator' => null,
'separator' => null,
'parentID' => null,
'navID' => $maxKey+1,
'active' => 1
),
'child' => array (
'1' => array (
'attributes' => array (
'label' => 'Settings',
'name' => 'Settings',
'url' => "civicrm/admin/setting/preferences/civisocial"
'operator' => null,
'separator' => 1,
'parentID' => $maxKey+1,
'navID' => 1,
'active' => 1
),
'child' => null
)
)
);
}
This will add a entry Civisocial
in your navigation table along with a child called Settings
.