1

I am new to writing an extension.

I add a tab in my contact with this example

function civitest_civicrm_tabs( &$tabs, $contactID ) {

  // unset the contribition tab, i.e. remove it from the page
  unset( $tabs[1] );

  // let's add a new "contribution" tab with a different name and put it last
  // this is just a demo, in the real world, you would create a url which would
  // return an html snippet etc.
  $url = CRM_Utils_System::url( 'civicrm/contact/view/contribution', "reset=1&snippet=1&force=1&cid=$contactID" );
  $tabs[] = array( 'id' => 'mySupercoolTab', 'url' => $url, 'title' => 'Contribution Tab Renamed', 'weight' => 300 );
}

What should be the next step to add a content in the tab?

how I have to use the extension and add where I have to create a new file to show all the content.

Please can you provide me an example

Thank You

3
  • Are you writing an extension, or... ?
    – Coleman
    Commented Apr 10, 2015 at 20:43
  • can you please elaborate a bit more. In general, civi will always pick a specific template for a specific url (i.e. the url -> template mapping is fixed and deterministic) Commented Apr 10, 2015 at 23:16
  • Hi Nilda, please post the same question only once. You can edit it if you want to change something.
    – Joe Murray
    Commented Apr 13, 2015 at 13:41

1 Answer 1

1

As the example says, "you would create a url which would return an html snippet".

Since this is in the context of a CiviCRM extension, please see the Civix documentation for how to create a basic page.

The url of your tab should be whatever you decide the url of that page should be.

1
  • I create an extension, but my new tab doesn't redirect to another page. my xml file is in the same file as my hook. My hook is develop as a plugin and my extension folder is in files/civicrm. Commented Apr 14, 2015 at 16:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.