Notice: Undefined index: content in template_preprocess_node() (line 1467 of drupal-7.x-dev\modules\node\node.module).

function template_preprocess_node(&$variables) {
...
  // Helpful $content variable for templates.
  foreach (element_children($variables['elements']) as $key) {
    $variables['content'][$key] = $variables['elements'][$key];
  }

  // Make the field variables available with the appropriate language.
  field_attach_preprocess('node', $node, $variables['content'], $variables); //<--line 1467

the content could be empty if links are removed with views module, body is empty and comment module disabled..

solution: add $variables['content'] = array(); before foreach..

CommentFileSizeAuthor
#2 node-preprocess-notice-1153022.patch503 byteslyricnz
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Pasqualle’s picture

Issue tags: +Novice
lyricnz’s picture

Priority: Normal » Minor
FileSize
503 bytes
lyricnz’s picture

Status: Active » Needs review
Pasqualle’s picture

Status: Needs review » Reviewed & tested by the community
catch’s picture

Version: 7.x-dev » 8.x-dev
Issue tags: +Needs backport to D7
webchick’s picture

Status: Reviewed & tested by the community » Fixed

Hm. This seems harmless enough, though it would undo $variables['content'] if it was set to anything before it. Looking at http://api.drupal.org/api/drupal/includes--theme.inc/function/theme though, it seems pretty safe to assume that this should come first.

Committed to 8.x and 7.x. Thanks!

Status: Fixed » Closed (fixed)

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

WilliamB’s picture

Getting this issue in Drupal 7.2