I've created a custom view mode called 'list' using entity view mode which outputs the fields I define for it. The issue I have is with the display of the node links. For my 'full content' and 'teaser' view modes I have a "add new comment" link if comments are open for the node. On my custom view mode this is not shown. Essentially, in the interface, my custom view mode is identical to the standard teaser view mode so Im not sure why the add new comment link isn't showing.
Further to this, if I add at least 1 comment to the node in question, the link displays on my custom view mode. So it would seem if the comment count is 0 then the link doesn't show for my custom view mode, however it shows fine on the default modes regardless of comment count.
Is this by design? It seems odd to only show a link to add a new comment if there is already comments on the node/entity.
Comments
Comment #1
core44 commentedSorry I've just realised that 'full mode' is not showing the link either, my bad. So it seems the link is only a feature of the 'teaser' view mode, so its visibility is probably set by the core comment module. Does anyone know how I can have this functionality on my custom view mode?
Comment #2
core44 commentedOk, figured out whats going on here. Turns out comment module does only output its links for the teaser view mode. So more research needed to figure out how to override that for my custom mode.
Comment #3
core44 commented...and finally, looking at the function comment_node_view() in the comment module, I can see I can use a hook_node_view_alter() in my theme / module to tell the link to output for my custom view mode. Something like... (briefly tested).
Hope this helps someone else with the same problem.