You are currently browsing the tag archive for the ‘module’ tag.

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.

June 2017
S M T W T F S
« May    
 123
45678910
11121314151617
18192021222324
252627282930  

Blog Stats

  • 72,598 hits