I've read every line of all the advanced_render() issues present over the last couple days... However, in my circumstance, It is still occurring in 2.10 version...

Fatal error: Call to a member function advanced_render() on a non-object in /var/www/imbee/sites/all/modules/contrib/views/theme/theme.inc on line 236

For me this is happening when trying to include a custom override template at the module level for the row output...

/**
* Implementation of hook_theme()
*/
function imbee_comments_theme() {
  return array(
    'views_view_fields__comments' => array(
      'template' => 'views-view-fields--comments',
      'path' => drupal_get_path('module', 'imbee_comments') . '/theme',
      'arguments' => array('view' => NULL, 'field' => NULL, 'row' => NULL),
      'original hook' => 'views_view_field',
      'type' => 'module',
      'preprocess functions' => array('template_preprocess', 'template_preprocess_views_view_field'),
    ),
  );
}

commenting out the preprocess line here will remove the error, but also lose the content obviously.
The custom tpl.php right now defined in views-view-fields--comments.tpl.php is the exact default code provided in the views-view-fields.tpl.php in the core views templates.

If I place this template in the theme folder, and remove the hook_theme() from my module, clear the cache... the issue goes away....
This is only happening trying to declare the theme function on the module level (which I do need in this case)

Merlin... yes, this is imbee! ;) Kory says hi!

CommentFileSizeAuthor
#6 views-theme-advanced-render-non-object-field-alias.patch576 bytesAnonymous (not verified)

Comments

merlinofchaos’s picture

This error happens because an invalid field ID is being rendered. Perhaps there is something wrong in your custom theme that is trying to render a field that does not exist?

himerus’s picture

I've managed to currently skirt the issue by using the theming at a different level of the views templating, BUT when this issue was present, the template that was being called was the exact same code provided in the default row style output template provided in the views folder, and in the theme information... Was on a comment type view... with all standard fields... hrm... I'm just not positive... I debugged until I was blue in the face, and found an alternative method, which just goes one level up to the style output level rather than the row level.

merlinofchaos’s picture

If you can give me reproduction instructions from a clean install, that would really be handy in figuring out what's wrong. It's hard to tell what'sg oing on here.

It does suggest to me that I should probably add validation to this function so that, in the worst case, we don't crash. It won't render anything but that's better than a whitescreen if this kind of thing keeps coming up.

merlinofchaos’s picture

Status: Active » Postponed (maintainer needs more info)
esmerel’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

No updates in more than 30 days.

Anonymous’s picture

After upgrading to Views 6.x-2.11 I am experiencing this error in conjunction with views_crosstab. Note, there was no error using views_crosstab with an earlier version of Views (2.8 I think).

The error is:

Fatal error: Call to a member function advanced_render() on a non-object in /path/to/modules/views/theme/theme.inc on line 225

To generate node totals using views_crosstab, I discovered that field id = 'nid', and the field_alias = 'some_other_field_total'. In the view the fields array contained the $field->field_alias as the id, and not $field->options['id'].

I therefore changed line 225 in views/theme/theme.inc to:

  if (!is_object($view->field[$field->options['id']])) {
    return $view->field[$field->field_alias]->advanced_render($row);
  }
  else {
    return $view->field[$field->options['id']]->advanced_render($row);
  }

Patch attached.

Not sure if this sheds any light on the problem, or whether in the opinion of views module developers, views_crosstab is incorrectly using field_alias?

AntiNSA’s picture

Status: Closed (won't fix) » Active

I am receiving the exact problems as #6. I want to add the patch , but am afraid it will destroy views. is this a safe patch to use with views 2?

dawehner’s picture

Try it out. That's the reason for patches.

AntiNSA’s picture

seems to work.

merlinofchaos’s picture

There's something else going on here.

I can't think of any circumstance in which the field_alias used should actually be the index of the field for advanced rendering. I would love to see some debug information showing me a situation where this is the case.

lecterro’s picture

The question is what should be replaced in line 225. In my file there is some comment on that line. Should it be the function: function template_preprocess_views_view_field(&$vars) edited?

iamjon’s picture

Status: Active » Postponed (maintainer needs more info)

hi,
does anyone have updated information about this issue or can provide replication instructions and an export?

marking this as postponed

iamjon’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

I'm marking this as closed. Please feel free to reopen with more information

chalu’s picture

Hello all, I've been having this same problem and applied the patch suggested, but now I have another error :
warning: Invalid argument supplied for foreach() in .../sites/all/modules/views_crosstab/views_crosstab_table.inc on line 82.

maybe this a what is stopping my crostab table from showing well. I want to build a "medals table / tally" similar to http://www.cwgdelhi2010.org/medal-tally. I have a node type called "medal entry" with which we intend to enter data for winners, it captures the athlete, institution (instead of country) and then a drop-down to select the medal which is either Gold, Silver or Bronze.

Displaying this as a normal views table, it will render like this

Institution Medal
UniBen Gold
UniJos Silver
UniLag Gold

However I want this instead :

Institution Gold Silver Bronze Total
UniBen 1     1
UniJos   1   1
UniLag 1     1

which is what the crosstab module sets out to achieve in the first place. Ok, but how do I configure it, what should I choose / select under Crosstab rows, Crosstab columns and Crosstab data ?

Please help ??

dreamer777’s picture

chalu, i have the same problem with the same warning. did you manage to solve it?

eft’s picture

FYI - A new D7 version of views_crosstab has been committed to a development branch. Please try it and create a new issue for any problems identified. Development is occuring on D7 branch only.