Problem/Motivation

Visiting admin/content/webform
leads to

Error: Call to a member function preview() on null in webform_admin_content() (Zeile 333 von /sites/all/modules/contrib/webform/includes/webform.admin.inc).

This is the related code in that area:

  // Determine whether views or hard-coded tables should be used for the
  // webforms table.
  if (!webform_variable_get('webform_table')) {
    $view = views_get_view('webform_webforms');
    return $view->preview('default');
  }

So it looks like it should use a non-existing view. No idea how it may have come to that situation.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork webform-3472546

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

anybody created an issue. See original summary.

anybody’s picture

I think we should simply make it bulletproof like this, just benefits:

  // Determine whether views or hard-coded tables should be used for the
  // webforms table.
  if (!webform_variable_get('webform_table')) {
    $view = views_get_view('webform_webforms');
    if($view){
      return $view->preview('default');
    }
  }

anybody’s picture

Status: Active » Needs review

Works perfectly and makes things even more robust without downsides. Good enough I think.

anybody’s picture

Workaround / alternative is to set the Drupal variable:
drush vset webform_table 1
if it is unset or false for any reason and you're running into this.

thomas.frobieter’s picture

Status: Needs review » Reviewed & tested by the community

  • liam morland committed a0ea10d1 on 7.x-4.x authored by anybody
    Issue #3472546: Load View only if it exists in webform_admin_content()
    
liam morland’s picture

Version: 7.x-4.26 » 7.x-4.x-dev
Status: Reviewed & tested by the community » Fixed

Thanks!

Status: Fixed » Closed (fixed)

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