Field API uses #view_mode key within the $element during formatting the field. It is supposed to be View Mode of the Entity being viewed. On other hand, Paragraphs module also uses #view_mode key for proper rendering (and template suggesting) of paragraphs-items.tpl.php which means that there should be View Mode of the ParagraphItem entity.

Please review attached patch.

CommentFileSizeAuthor
paragraphs-view_mode_fix.patch1.38 KBxumepadismal

Comments

xumepadismal created an issue. See original summary.

ngocketit’s picture

Can somebody please confirm this issue and the patch?

damienmckenna’s picture

Some tests might help to confirm the bug and then confirm the fix.

jeroen.b’s picture

Status: Needs review » Needs work

Also. What's the exact issue here? When I breakpoint at that point $view_mode is 'full' for me. The view mode of the node I'm looking at.

After some testing I see what you are talking about when using nested paragraphs, but I'm not sure this is a problem in Paragraphs, it does not seem to make sense to pass the view mode of the top entity being viewed as #view_mode...

hanoii’s picture

Status: Needs work » Closed (duplicate)

Although this one is older, the duplicate one (with the exact same patch) covers a valid issue with DS.

Duplicate of #3044164: Display suite field templates ignored when paragraphs are in display mode loaded by views