$vars['node'] doesn't exist in html5_base_preprocess_page. See lines 62, 145, 148.

Also, on that note, I'm fairly sure core does a lot of the template suggestions itself, not sure we need all of that.

CommentFileSizeAuthor
#3 notice.patch8.55 KBsreynen

Comments

mason@thecodingdesigner.com’s picture

Not sure what you mean about $vars['node'] not existing. It's there when I do a dsm($vars). As for lines 145 and 148. I believe core provides template suggestions for node.tpl.php based on type and nid, but not for page.tpl.php. oh, scratch that. Core suggests page templates for nid, but not node type. I can kill the second one.

tim.plunkett’s picture

With E_NOTICE enabled, I get this on every page:

notice: Undefined index: node in /Users/tim/www/dev6/sites/all/themes/html5_base-HEAD/template.php on line 62.
notice: Trying to get property of non-object in /Users/tim/www/dev6/sites/all/themes/html5_base-HEAD/template.php on line 62.
notice: Undefined index: node in /Users/tim/www/dev6/sites/all/themes/html5_base-HEAD/template.php on line 145.
notice: Trying to get property of non-object in /Users/tim/www/dev6/sites/all/themes/html5_base-HEAD/template.php on line 145.
notice: Undefined index: node in /Users/tim/www/dev6/sites/all/themes/html5_base-HEAD/template.php on line 148.
notice: Trying to get property of non-object in /Users/tim/www/dev6/sites/all/themes/html5_base-HEAD/template.php on line 148.

If you go to example.com/user, html5_base_preprocess_page is called, but there would be no $vars['node'].

template_preprocess_page uses menu_get_object(), but also uses isset($vars['node']) throughout.

sreynen’s picture

Status: Active » Needs review
StatusFileSize
new8.55 KB

Attached patch adds some isset($vars['node']) to fix these notices. I also fixed some coding standards issues (indentation and comment style) while I was at it.

mason@thecodingdesigner.com’s picture

Status: Needs review » Fixed

Looks good. I applied the patch and removed that redundant template suggestion.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.