warning: call_user_func(summertime_menu_item_link) [function.call-user-func]: First argument is expected to be a valid callback in F:\htdocs\hd\sites\all\modules\special_menu_items\special_menu_items.module on line 125.
warning: call_user_func(summertime_menu_item_link) [function.call-user-func]: First argument is expected to be a valid callback in F:\htdocs\hd\sites\all\modules\special_menu_items\special_menu_items.module on line 125.
warning: call_user_func(summertime_menu_item_link) [function.call-user-func]: First argument is expected to be a valid callback in F:\htdocs\hd\sites\all\modules\special_menu_items\special_menu_items.module on line 125.
warning: call_user_func(summertime_menu_item_link) [function.call-user-func]: First argument is expected to be a valid callback in F:\htdocs\hd\sites\all\modules\special_menu_items\special_menu_items.module on line 125.

Comments

mikeker’s picture

It seems to happen when a theme overrides theme_menu_item_link. Line 125 calls the former menu_item_link function, but the theme code is not in scope.

A quick fix is to move your theme override into a module.

mikeker’s picture

Another option: implement hook_theme() in your theme's template.php file to ensure the proper file is included before special_menu_items calls you override. Something similar to:

function example_theme($existing, $type, $theme, $path) {
  global $theme_path;
  return array(
    'menu_item_link' => array(
      'arguments' => array(),
      'function' => 'example_menu_item_link',
      'file' => 'template.php',
      'path' => $theme_path,  // Assumes template.php lives in your theme's root directory
    ),
  );
}

function example_menu_item_link($link) {
  ...
}

Probably simpler than building a new module...

mikeker’s picture

After a bit more chasing my tail, I think this may be related to having an admin theme in addition to a main theme that overrides theme_menu_item_link, in which case the above mentioned fix will not help.

The block of code around line 125 should be:

  else {
    if (is_callable($theme_overwrite)) {
      return call_user_func($theme_overwrite, $link);
    }
    else {
      return;    // ...or something else?
    }
  }

Sorry to be polluting this thread so badly. I really hope this is the last comment I make on this issue!

bakr’s picture

Your pollution is green!
Do not worry, thanks a lot for the (p/s)olution and commitment.

jdanthinne’s picture

The solution in #3 is almost ok with an admin theme: I don't get errors, but I don't get menus!
I've changed return; to return call_user_func('theme_menu_item_link', $link);, and it seems to be working.