You are here

function _statistics_advanced_check_link_alter in Statistics Advanced 6

Check that the correct parameters are passed to hook_link_alter().

A lot of modules that were convered from Drupal 5 to 6 did not switch the parameters around and cause errors.

@todo Remove when http://drupal.org/node/321295 is fixed.

1 call to _statistics_advanced_check_link_alter()
statistics_advanced_link_alter in ./statistics_advanced.module
Implementation of hook_link_alter().

File

./statistics_advanced.module, line 68
Adds advanced settings and features for the core Statistics module.

Code

function _statistics_advanced_check_link_alter($links, $node) {
  if (!is_array($links) || !is_object($node)) {
    $message = 'Invalid parameters for hook_link_alter(). Please report this message to <a href="http://drupal.org/node/321295">http://drupal.org/node/321295</a>.';
    $backtrace = array_slice(debug_backtrace(), 2, 2);
    foreach ($backtrace as $index => $caller) {
      $message .= '<br />' . strtr('line @line in @file (@function)', array(
        '@file' => $caller['file'],
        '@line' => $caller['line'],
        '@function' => $caller['function'],
      ));
    }
    drupal_set_message($message, 'error', FALSE);
    watchdog('statistics_adv', $message, array(), WATCHDOG_ERROR);
    return TRUE;
  }
}