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
Comment #2
jantoine commentedAttached patch returns immediately if the view is not set.
Comment #3
denix commentedThanks! It works!
Comment #4
mglamanThanks! 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.
Comment #6
mglamanThanks for the fix!