Problem/Motivation

I receive the following error multiple times when visiting the view or recreate page for a feature that contains default views:

Notice: Trying to get property of non-object in commerce_kickstart_taxonomy_views_default_views_alter() (line 208 of /var/www/html/profiles/commerce_kickstart/modules/commerce_kickstart/commerce_kickstart_taxonomy/includes/views/commerce_kickstart_taxonomy.views_default.inc).

Features appears to be calling the hook_views_default_views_alter() hook for each module with only that modules default views set in the $views variable rather than calling the hook once with all default views for all modules. I could see where this could be done by other modules as well, so we should check that a view exists before trying to alter it.

Proposed resolution

Check that the 'collection_products' view exists before attempting to alter it.

Remaining tasks

  • Review and confirm the problem
  • Test patch
  • Commit

Comments

jantoine created an issue. See original summary.

jantoine’s picture

Status: Active » Needs review
StatusFileSize
new962 bytes

Attached patch returns immediately if the view is not set.

denix’s picture

Thanks! It works!

mglaman’s picture

Thanks! This is a thing I've dealt with before, too. Here is PR and test run https://github.com/commerceguys/commerce_kickstart/pull/199. I can commit once tests pass.

  • mglaman committed da166b7 on 7.x-2.x
    Issue #2687975 by jantoine: Error attempting to alter the '...
mglaman’s picture

Status: Needs review » Fixed

Thanks for the fix!

Status: Fixed » Closed (fixed)

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