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 (Moderator: Donald Lobo) »
  • using hook_civicrm_links
Pages: [1]

Author Topic: using hook_civicrm_links  (Read 2483 times)

dougall

  • Guest
using hook_civicrm_links
March 31, 2008, 04:43:56 am
Hi,

I'm trying to insert UI into CiviCRM using hook_civicrm_links, so as a test i'm simply logging the hook function parameter details to a file when the function is called. I'm following the instructions from the wiki:
http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+hook+specification#CiviCRMhookspecification-UIHookfunctionsignatures

However nothing seems to be happening at all (certainly nothing is logged) so it doesn't appear that the hook function is being called.

I'd be grateful if someone could either point me in the direction of a working example, or let me know if there's any known issues with using this hook.

Thanks ... Dougall

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 hook_civicrm_links
March 31, 2008, 11:24:09 am

Can you paste your code here and the url in which you expect the hook to be called. (I think the hook is only called in the Contact View screen)

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

dougall

  • Guest
Re: using hook_civicrm_links
April 01, 2008, 01:42:07 am
here is my code, it's in the main module script (pxp.module in this case)
Code: [Select]
  function hook_civicrm_links( $op, $objectName, $objectId ) {
    writeToLogFile("<br><hr><br>hook_civicrm_links( $op, $objectName, $objectId )");
    return null;
  }

...it uses this function:
Code: [Select]
  function writeToLogFile($str) {
    file_put_contents(PXP_LOG_DIR_LOCATION."PXP_Module_Log.html",
                      "$str<BR>\n", FILE_APPEND);
  }

the url i was hoping would result in calling this hook is:
Quote
http://localhost/drupal-5.7/index.php?q=civicrm/contact/view&reset=1&cid=1

This results in nothing being added to the log file (I know the logging code works because I'm using it to view details of pre and post hook calls).

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 hook_civicrm_links
April 01, 2008, 01:53:14 am

rename the function:

hook_civicrm_links to

pxp_civicrm_links

civicrm hooks follow drupal naming conventions

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

dougall

  • Guest
Re: using hook_civicrm_links
April 01, 2008, 02:00:31 am
whoops .... thanks

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • using hook_civicrm_links

This forum was archived on 2017-11-26.