After installing nice_menus i get this "Notice: Undefined index: #original_link in basic_menu_link() (line 150 of /home/dmateo1/public_html/sites/all/themes/basic/template.php)." I looked in the template.php file and (me being a noob) I have no idea how to fix this issue. I'm using the basic theme (build off from zen themes).

Here's the function/code:

function basic_menu_link(array $variables) {
$element = $variables['element'];
$sub_menu = '';

if ($element['#below']) {
$sub_menu = drupal_render($element['#below']);
}
$output = l($element['#title'], $element['#href'], $element['#localized_options']);
// Adding a class depending on the TITLE of the link (not constant)
$element['#attributes']['class'][] = basic_id_safe($element['#title']);
// Adding a class depending on the ID of the link (constant)
[line 150] $element['#attributes']['class'][] = 'mid-' . $element['#original_link']['mlid'];
return '

  • ' . $output . $sub_menu . "
  • \n";
    }

    Comments

    RichFingerland’s picture

    Priority: Major » Normal
    Status: Active » Needs work

    I've tried to use error_reporting(E_ALL ^ E_NOTICE); in php.ini, settings.php, and I've also tried other things to get the notices to stop working. What worked for me to remove notices was putting error_reporting(E_ALL ^ E_NOTICE); in the template.php inside the basic theme for my website. It's not a permanent fix, just a quick on to get rid of notices, though I'd still like to know exactly how to fix the "undefined index" problem. I'll keep doing more research.

    kerasai’s picture

    Status: Needs work » Needs review
    StatusFileSize
    new888 bytes

    The error is caused by some themes that override the theme_menu_link() function. They're expecting some data which isn't there. This has been addressed by theme developers in some cases, see #1458848: Undefined index #original_link.

    Here is a patch to fix this on the nice_menus side.

    duaelfr’s picture

    I cannot access your patch file. Could you please repost it ?

    kerasai’s picture

    Reposting patch from above. Not sure why it's 404-ing.

    kerasai’s picture

    Sorry, one more try. It was the # in the file name.

    duaelfr’s picture

    #5 worked for me thanks
    +1 RTBC

    gaurav_m’s picture

    Facing the same issue, Thanks! for the patch.

    mikefyfer’s picture

    Patch in #5 worked for me! Thanks.

    kristinkelley’s picture

    I am still new at this, Where do I paste the patch into?

    mikefyfer’s picture

    There are a handful of ways to apply patches, most of them quick and easy through command line if you're comfortable with it.

    This link should help: http://drupal.org/patch/apply

    jweedman’s picture

    Status: Needs review » Patch (to be ported)

    The patch in #5 worked for me! That's 4 confirmations - seems legit! Thanks, bmoresafety20!

    spiderstave’s picture

    Any chance of an updated file for those of us who aren't technically able to apply the patch?

    eaton’s picture

    Status: Patch (to be ported) » Reviewed & tested by the community

    Tested and it looks good. For future reference, #original_link is a property normally added by core in the menu_tree_output() function (line 1066). It's not USED by any of the core theme functions when rendering menu trees, so it only breaks when custom themes jump in to override the tree rendering.

    vordude’s picture

    Status: Reviewed & tested by the community » Closed (fixed)

    Committed
    http://drupalcode.org/project/nice_menus.git/commit/94f49886c0fbc9317bd7...

    Thanks to eaton for the clarification.

    spiderstave check out http://drupal.org/patch/apply

    pya26’s picture

    #5 worked. Thank you.

    deaftone’s picture

    #5 thanks!