You are currently browsing the monthly archive for July 2013.

Using the Taxonomy (Tag) and Relevant Content Module 7.x-1.x-dev, I encountered this error as I’m developing a website made of Drupal 7.

Error produced when a Relevant module display an empty Tag on Term Reference field.

The bug is after I deleted/emptied the tag/term, and the label of the Relevant Content doesn’t go away.

* Notice: Undefined index: title in relevant_content_field_formatter_view() (line 629 of /myserver/sites/all/modules/relevant_content/relevant_content.module).
* Notice: Undefined index: nid in relevant_content_field_formatter_view() (line 629 of /myserver/sites/all/modules/relevant_content/relevant_content.module).

To fix the bug, open the relevant_content.module and check line 629…

// Loop over all the items and create the field output
foreach ($items as $item) {
// Depending on the type, render a field
switch ($item_style) {
default:
case 'default' :
$result = l($item['title'], 'node/' . $item['nid']); //This line
break;

case 'plain' :
$result = check_plain($item['title']);
break;

case 'teaser' :
case 'full' :

For a quick fix, insert this code after the case ‘default’:
if (empty($item)) return;

// Loop over all the items and create the field output
foreach ($items as $item) {
// Depending on the type, render a field
switch ($item_style) {
default:
case 'default' :
if (empty($item)) return; // added additional code here
$result = l($item['title'], 'node/' . $item['nid']);
break;

case 'plain' :
$result = check_plain($item['title']);
break;

The error’s gone, but I rather submit this issue to the module developer for future use.

July 2013
S M T W T F S
« May   Aug »
 123456
78910111213
14151617181920
21222324252627
28293031  

Blog Stats

  • 73,162 hits