Answers.Body: <p>It's strongly recommended you use the navigationMenu hook in your extension.php file.</p>
  
  <pre><code>function civisocial_civicrm_navigationMenu( &amp;$params ) {
      $maxKey = ( max( array_keys($params) ) );
      $params[$maxKey+1] = array (
          'attributes' =&gt; array (
              'label'      =&gt; 'Civisocial',
              'name'       =&gt; 'Civisocial',
              'url'        =&gt; null,
              'permission' =&gt; null,
              'operator'   =&gt; null,
              'separator'  =&gt; null,
              'parentID'   =&gt; null,
              'navID'      =&gt; $maxKey+1,
              'active'     =&gt; 1
      ),
          'child' =&gt;  array (
              '1' =&gt; array (
                  'attributes' =&gt; array (
                      'label'      =&gt; 'Settings',
                      'name'       =&gt; 'Settings',
                      'url'        =&gt; "civicrm/admin/setting/preferences/civisocial"
                      'operator'   =&gt; null,
                      'separator'  =&gt; 1,
                      'parentID'   =&gt; $maxKey+1,
                      'navID'      =&gt; 1,
                      'active'     =&gt; 1
                  ),
                  'child' =&gt; null
              ) 
          ) 
      );
  }
  </code></pre>
  
  <p>This will add a entry <code>Civisocial</code> in your navigation table along with a child called <code>Settings</code>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-13T18:18:06.013Z
Answers.LastActivityDate: 2015-08-14T05:08:18.703Z
Answers.LastEditDate: 2015-08-14T05:08:18.703Z
Answers.UserDisplayName: Siddharth Gupta
Body: <p>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.</p>
  
Tags: <extension><gsoc><menu>
Title: Generating extension menu when extension is installed
ThreadText: # Generating extension menu when extension is installed
  
  (Asked by: username_0 on 2015-08-09)
  
  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.
  
  **Tags:** extension, gsoc, menu
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-08-13. Score: 2
  
  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.
  
  
  ---
  
  