I'm using the photoswipe module in a D8.1 installation and love it!
However, I build my pages with paragraphs, therefor I never have my image fields attached to the node itself but the paragraph entity (the paragraph is being attached to a node via a entity reference field).
When calling my pages, I get then following error:
Notice: Trying to get property of non-object in template_preprocess_photoswipe_image_formatter() (line 81 of photoswipe.theme.inc).
It's caused when setting the caption variable, the module always expects a node as host entity.
I've changed the naming from $node
to $entity
and added a new $node variable which is being set by \Drupal::routeMatch()->getParameter('node');
.
I will upload a patch which fixes the mentioned issue, feel free to comment on it and test it.
Comment | File | Size | Author |
---|---|---|---|
#2 | node-title-for-nested-entities-2712261-2.patch | 1008 bytes | dpacassi |
Comments
Comment #2
dpacassiSee attached my patch.
Comment #3
ParisLiakos CreditAttribution: ParisLiakos commentedNice, but this probably does not work when the node is viewed in another page, like a teaser eg where the route match will return no result.
Comment #4
AnybodyPlease retry with the latest dev!
Comment #5
AnybodyPlease try the latest 2.x version. It already contained a fix to use the parent instead of the node. I now also renamed the variable to better explain that.
Comment #6
Anybody