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) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Drupal's hook_node_info is called on all page views?
Pages: [1]

Author Topic: Drupal's hook_node_info is called on all page views?  (Read 1647 times)

joachim

  • Guest
Drupal's hook_node_info is called on all page views?
July 25, 2008, 02:59:29 am
I'm working on a custom Drupal module which implements hook_node_info.
For testing purposes this function sends a message to the browser.
I have noticed this message is shown on all CiviCRM pages.
This leads me to conclude that CiviCRM is invoking this Drupal hook on every page... am I right? Isn't that a bit intensive if that's the case?

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: Drupal's hook_node_info is called on all page views?
July 25, 2008, 03:07:00 am

you might want to do a bit more due diligence and put a backtrace in your implementation of hook_node_info and track who is calling it (and then figure out why). Check: http://nz.php.net/manual/en/function.debug-print-backtrace.php

I'm pretty sure CiviCRM does not call it (civicrm calls very few drupal hooks, i think the only hook we call might be the user hook)

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

joachim

  • Guest
Re: Drupal's hook_node_info is called on all page views?
July 25, 2008, 03:22:01 am
The backtrace is leaving me none the wiser I'm afraid.
I've shoved in a test statement in that hook in another module, which isn't getting called. So it's not invoking everything, you're right.

And I'm accessing the Civi API from my module's hook, like this:

Code: [Select]
function civi_contact_node_node_info() {
  // initialize CiviCRM and load API
  civicrm_initialize(TRUE);
  require_once 'api/v2/Contact.php';
  $params = array();
  $civi_groups = civicrm_groups_get( $params ); // note: only active groups returned

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Drupal's hook_node_info is called on all page views?

This forum was archived on 2017-11-26.