CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Creating a new Tab for the Contact page
Pages: [1]

Author Topic: Creating a new Tab for the Contact page  (Read 1071 times)

pbarmak

  • I post occasionally
  • **
  • Posts: 111
  • Karma: 3
  • CiviCRM version: 3.3.5
  • CMS version: Pressflow 6.19
  • MySQL version: 5.1
  • PHP version: 5.2.10
Creating a new Tab for the Contact page
March 09, 2011, 04:35:05 pm
Hey all,
I'd like to create a custom Tab under the Contact Summary page.  What are the general steps to do that?

Thanks.

Rajan Mayekar

  • I post frequently
  • ***
  • Posts: 177
  • Karma: 20
    • Rajan's Blogs
Re: Creating a new Tab for the Contact page
March 09, 2011, 08:30:41 pm
Using CiviCRM hooks you can do this
Refer: http://wiki.civicrm.org/confluence/display/CRMDOC33/CiviCRM+hook+specification#CiviCRMhookspecification-hookcivicrmtabs

Rajan

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Creating a new Tab for the Contact page
March 10, 2011, 12:42:44 am
In case you mean you want a tab to show along with Relationships, Change Log etc with some Custom fields in it, create a new Set of Custom Data and set it to Tab not Inline.
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

pbarmak

  • I post occasionally
  • **
  • Posts: 111
  • Karma: 3
  • CiviCRM version: 3.3.5
  • CMS version: Pressflow 6.19
  • MySQL version: 5.1
  • PHP version: 5.2.10
Re: Creating a new Tab for the Contact page
March 10, 2011, 04:36:08 am
I should have explained myself a little better, sorry about that.  What I would like to do is a have a new tab that points to some php file I created which outputs HTML of data from Civi joined to other sources, etc (not necessarily just Civi info).  Basically, I have some code that displays a table of information or two, related to a contact, and I'd like to show that in a contact tab (in between Contributions and Pledges, in our case).  It's not just civi custom groups/fields, but my own code, if you will.

Rajan, I have read and tried out the civicrm_tabs hook, but I think my confusion is at a higher level than that.  I have no clue how the url string in the hook points to a specific file on the server.  So, where do I put my php code, and then how to I reference that in the hook properly?  It seems like I'm just missing something simple here.  Maybe because I don't understand how Drupal is translating the URL to point to actual files.

Does anyone have just the basic step-by-step instructions for this?  I need to know:
-- what types of files to create - do I need a php file plus a template file?
-- where to put those files
-- how to reference those files in the hook
-- if the php/template code needs to have any special handling so it all works

I hope this all makes sense - I couldn't find a single place that has these steps (except for some old wiki doc that doesn't say the name of files, just shows code snippets).  I sure would appreciate some help here, apologies for being relatively new to this area.

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Creating a new Tab for the Contact page
March 10, 2011, 04:41:09 am
Hi,

You might want to ask that on drupal's site you will get more support but in a nutshell:

- create a module
- add the menu for your url and php code
- add a hook to add the tab and point to that url and php code

Our  book details the process and provide you more pointers

http://en.flossmanuals.net/CiviCRM/DevelopHooks

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Rajan Mayekar

  • I post frequently
  • ***
  • Posts: 177
  • Karma: 20
    • Rajan's Blogs
Re: Creating a new Tab for the Contact page
March 10, 2011, 08:08:50 pm
Yupe, as told above u need to write custom drupal module,
So hook_menu ( http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hook_menu/6 ) will register the url and function ( ie page ) to be call for that menu, in this function u can build your date to be displayed on the contact tab.
Then u just need to implement hook_civicrm_tabs with the url that u registered using hook_menu.

Rajan

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Creating a new Tab for the Contact page

This forum was archived on 2017-11-26.