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 '
\n";
}
Comments
Comment #1
RichFingerland commentedI'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 puttingerror_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.Comment #2
kerasai commentedThe 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.
Comment #3
duaelfrI cannot access your patch file. Could you please repost it ?
Comment #4
kerasai commentedReposting patch from above. Not sure why it's 404-ing.
Comment #5
kerasai commentedSorry, one more try. It was the # in the file name.
Comment #6
duaelfr#5 worked for me thanks
+1 RTBC
Comment #7
gaurav_m commentedFacing the same issue, Thanks! for the patch.
Comment #8
mikefyfer commentedPatch in #5 worked for me! Thanks.
Comment #9
kristinkelley commentedI am still new at this, Where do I paste the patch into?
Comment #10
mikefyfer commentedThere 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
Comment #11
jweedman commentedThe patch in #5 worked for me! That's 4 confirmations - seems legit! Thanks, bmoresafety20!
Comment #12
spiderstave commentedAny chance of an updated file for those of us who aren't technically able to apply the patch?
Comment #13
eaton commentedTested 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.
Comment #14
vordude commentedCommitted
http://drupalcode.org/project/nice_menus.git/commit/94f49886c0fbc9317bd7...
Thanks to eaton for the clarification.
spiderstave check out http://drupal.org/patch/apply
Comment #15
pya26 commented#5 worked. Thank you.
Comment #16
deaftone commented#5 thanks!
Comment #17
batigolixSee also #1453662: PHP notice: Undefined index: #original_link in ./adaptivetheme/inc/template.theme.inc