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) »
  • Discussion (deprecated) »
  • Alpha and Beta Release Testing »
  • 3.0 Release Testing »
  • Using the new "hook" which can add elements on the Contact Summary Page
Pages: [1]

Author Topic: Using the new "hook" which can add elements on the Contact Summary Page  (Read 5769 times)

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Using the new "hook" which can add elements on the Contact Summary Page
September 24, 2009, 03:28:33 pm
I would like to take advantage of the new hook described  by issue "CRM-4599 (Provide a "hook" which can be used customize the elements on the Contact Summary page (add or replace contents).

What is the name of the new hook and what are the parameters? How can I add some extra info that I calculate based on the person's date of birth, gender, date of death, and 2 custom fields.

I am using Joomla 1.5.x and Drupal 6.

Thanks,
Sarah

Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Using the new "hook" which can add elements on the Contact Summary Page
September 24, 2009, 03:49:44 pm

check:

http://wiki.civicrm.org/confluence/display/CRMUPCOMING/CiviCRM+hook+specification#CiviCRMhookspecification-hookcivicrmsummary

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Using the new "hook" which can add elements on the Contact Summary Page
September 26, 2009, 04:14:05 pm
Thanks- that is just what I needed.  BTW: Is the information about writing hooks for Joomla at http://civicrm.org/node/631  unchanged for version 3.0 ?


  
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Using the new "hook" which can add elements on the Contact Summary Page
September 27, 2009, 07:45:25 am

yep, that blog entry should still be valid. if you notice any discrepancies or can improve the entry, please comment on the blog file

would be great to create a wiki documentation for writing hooks in joomla and link to the hooks documentation page

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Using the new "hook" which can add elements on the Contact Summary Page
September 27, 2009, 01:36:47 pm
I will link the new Joomla hooks wiki page to the existing page at: http://wiki.civicrm.org/confluence/display/CRMUPCOMING/CiviCRM+hook+specification#CiviCRMhookspecification-hookcivicrmtabs    ( which currently points Joomla folks to a forum post with obsolete info. )

I got my hook working for the contact summery screen in Joomla 1.5.14 and CiviCRM 3.0 beta 5. But I ended up having to include a bunch of HTML in my hook so that my data is presented in the same style/layout as the other information on that screen. Which means that if CiviCRM core files change the HTML and css for the contact summary screen, I will have to update my hook so that my HTML matches.    Perhaps the hook could have parameters where I just pass the array of labels and values that I want shown, and CiviCRM wraps it in the proper HTML.   ( Although I can imagine some use cases where other people will want full control of the HTML. )  

Perhaps there could be a constant similar to CRM_Utils_Hook::SUMMARY_BELOW that would control layouts. Such as CRM_Utils_Hook::SUMMARY_STYLE_CORE  

« Last Edit: September 27, 2009, 02:25:35 pm by sgladstone »
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Using the new "hook" which can add elements on the Contact Summary Page
September 27, 2009, 08:27:57 pm

Would be great if you can submit a patch to handle: CRM_Utils_Hook::SUMMARY_STYLE_CORE

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Using the new "hook" which can add elements on the Contact Summary Page
September 29, 2009, 10:29:16 am
I am planning to have a second hook to allow the new parameters without impacting the existing hook for folks who need to do their own HTML.

ie the 2 hooks will be:

// Add some html content to the contact summary screen
hook_civicrm_summary( $contactID, &$content, &$contentPlacement  )

// add some content to the contact summary screen. Presentation  is controlled by the $contentFormat parm.
hook_civicrm_summary_formated( ( $contactID, &$content_labels_and_values, &$contentPlacement, &$contentFormat)
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Using the new "hook" which can add elements on the Contact Summary Page
September 29, 2009, 10:37:03 am

rather than having too many hooks, you should combine the two hooks in one. you can make contentFormat an optional parameter for the formatted case

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Alpha and Beta Release Testing »
  • 3.0 Release Testing »
  • Using the new "hook" which can add elements on the Contact Summary Page

This forum was archived on 2017-11-26.