Error: Call to a member function view() on null in template_preprocess_photoswipe_image_formatter() (row 84 file /modules/photoswipe/photoswipe.theme.inc).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Nikit created an issue. See original summary.

Nikit’s picture

Issue summary: View changes
geisel’s picture

This issue seems to occur when a new display mode has been added for a content type, but the "Photoswipe Caption" has not yet been set. The default value for this gets set in PhotoswipeFieldFormatter.php to empty string (in defaultSettings()). In photoswipe.theme.inc it ends up trying to resolve $node->EmptyString->view(), which results in badness.

It seems like there may be a more correct way to fix this, but this patch should resolve the issue gracefully and will put a warning in the Drupal Report Log.

Nikit’s picture

Status: Active » Fixed
Nikit’s picture

Status: Fixed » Needs review
Niklan’s picture

The patch from #3 is fixed the issue! Thank you.

Alezu’s picture

Patch works perfectly, thanks a lot!

geisel’s picture

Anything I can do to help resolve the "Needs Review" status, or do we need one of the maintainers to do it?

Anybody’s picture

@Geisel, could you please reroll the patch? It contains wrong (local!) paths. Before please try the latest dev, perhaps the issue is already solved.
Thanks!

Status: Needs review » Needs work

The last submitted patch, 3: photoswipe-caption-unset-2666636-3-D8.patch, failed testing. View results

Anybody’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev

Please retry with latest 8.x-2.x branch. Perhaps it works without the patch. Otherwise please reroll it.

Anybody’s picture

Priority: Critical » Normal
Status: Needs work » Fixed

Thank you geisel, I rerolled the branch and commited on the 8.x-2.x branch. Please test and report.

  • Anybody committed 44c70dd on 8.x-2.x
    Issue #2666636 by geisel, Anybody: Error: Call to a member function view...

Status: Fixed » Closed (fixed)

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