Create a content type
Set it to use a custom display style for full node display
set the full node display to a 2 column layout
put the title in the left column, and the body and comments in the right.

Displays correctly when you view the node (title on the left and body and comments on the right.

Now create a view that lists content of this type, and set the style to Display suite, and the View mode to Full content.

When you view the view, everything looks correct, except the comments are completely missing.

Comments

mrfelton’s picture

Status: Active » Needs review
StatusFileSize
new1.04 KB

The problem seems to stem from the fact that comment.module only loads the comments onto the node if you are on the node view page, and so when viewing the node in a views listing they don't get loaded.

In the Views module, there is an option to include the commets in either teaser of full mode which basically causes the comments to be loaded with comment_node_page_additions() in template_preprocess_views_view_row_node(). If I set my view to use Content instead of Display suite as the row style, comments are loaded as expected.

If however I set the row style to Display suite, and select my build mode (full in this case), comments do not load. The attached patch resolves this.

mrfelton’s picture

StatusFileSize
new627 bytes

Oops, wrong patch. This is the one I meant!

swentel’s picture

Shouldn't this be optional also with some sort of checkbox ? Seems overhead to load comments in case you don't want to display them ?

mrfelton’s picture

The comments field is available for use in display suite layouts by default. I guess that we could check to see if the field has been included in a region and only load the comments if they have.

Also, as a sidenote, the comments field doesn't seem to be available for use for Teaser build modes, only Full mode (possibly custom modes too, I haven't checked those). I would have though that the comments field should be available foe use in all build modes.

swentel’s picture

Yeah, the comment field is limited to default and full, see ds.ds_fields_info.inc because somehow that seems natural to me, might be wrong of course.

      'ui_limit' => array('*|default', '*|full'),
mrfelton’s picture

Seems wrong to me. When you are building a View using a normal Node display (without Display Suite), you have the option from within the Views UI to include the comments in both Full mode and Teaser mode. Display should also allow this flexibility IMO.

mrfelton’s picture

Removing that line in ds.ds_fields_info.inc gets that working for me - now I can display comments in teaser mode too.

swentel’s picture

Well, I agree it should be available on all view modes, but comment.module itself does this:

    if ($node->comment && $view_mode == 'full' && node_is_page($node) && empty($node->in_preview)) {
      $node->content['comments'] = comment_node_page_additions($node);
    }

so they won't be available when just called with node_view() and a different view mode. I'll check tonight to get this option in the views UI however.

bryancasler’s picture

subscribe

swentel’s picture

Status: Needs review » Fixed

Committed to dev - with an option in the UI as well. Thanks!

Status: Fixed » Closed (fixed)

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

bassplaya’s picture

Issue summary: View changes
StatusFileSize
new18.73 KB

@swentel: Does this mean we have to deploy the dev version of DS to have comments to show up in a View?
I'm using comments to set a message for moderation purposes of a collaborator's content and so I need the comments to show on my custom view mode.
Also, there is the option in views to show comments or not so I'm not getting why the comments are not loaded then if the option is there.

In Views I see this:
load comments for every node to display

bassplaya’s picture

Status: Closed (fixed) » Active

@swentel, I'd like to know if the fix will be moved into the beta version.

bassplaya’s picture

@swentel, I'd like to know if the fix will be moved into the beta version.

swentel’s picture

Status: Active » Closed (fixed)

It's in DEV, there won't be a new beta version anymore, there will be a new release though soon.

bassplaya’s picture

Thanks!

bassplaya’s picture

@swentel I've downloaded the dev version as you said it was in the DEV version but it still doesn't show up. Then I tried with a clean install:
- created a custom view mode
- created a view for articles in an HTML list
- saved it
- set the style to Display Suite
- selected my view mode
- kept the "load comments" ticked
- generated 50 articles with comments,
- comment display has no particular comment display suite view mode and shows "comments"

If I check each node separately or even the front page, all comments show but not in my view.
I used DS 7.x-2.6+29-dev (which should be the latest dev version) and Views 7.x-3.8 in Drupal 7.32

Do I still need to apply this patch that was talked about or is that integrated in the DEV release specified in my post here?
Thanks for getting back to this.