Consider the following scenario:
1. Build out site with comments enabled on content types, and add content
2. Build a view over a content type w/ a page display. Configure the Row Style to be Content.
3. For the display settings, check Display Comments
4. Make sure view works.
5. Disable comments
6. Browse to the URL for the page display you made in step 2.
You should either be looking at a error message
Fatal error: Call to undefined function comment_node_page_additions() in /var/www/XXX/docroot/sites/all/modules/views/modules/node.views.inc on line 719
or a WSOD if PHP errors are off.
The problem is that some comment support is baked into Views in the node handlers w/o proper detection of whether comment.module is enabled.
Forgive me if this is a dup, but I didn't find one.
Comment | File | Size | Author |
---|---|---|---|
#6 | views-comment_detection-2292721-1-d7.patch | 1.61 KB | mpdonadio |
| |||
#1 | views-comment_detection-2292721-1-d7.patch | 1.61 KB | mpdonadio |
Comments
Comment #1
mpdonadioHere is a quick patch that checks to see if comment.module is enabled. It
1. Sets the #access on the Display comments checkbox in the display mode settings if it is disabled.
2. Checks whether comment.module is enabled before adding them to the $vars for rendering.
I do not know if this needs to also be done to Drupal 8, as comments are now fields, which means the setting is gone and you can't disable comments if there is field data.
Comment #2
mpdonadioForgot to set status.
Comment #3
xjmI tested the following steps in D8:
So this bug (or anything like it) doesn't exist in D8, at least for the full node row style. :) I didn't test a view with comment fields and a field row style.
Comment #4
dawehnerSo yeah this bug probably just appeared if you are an admin, because otherwise user_access() would have failed.
Comment #5
colanWe've recently switched our testing from the old qa.drupal.org to DrupalCI. Because of a bug in the new system, #2623840: Views (D7) patches not being tested, older patches must be re-uploaded. On re-uploading the patch, please set the status to "Needs Review" so that the test bot will add it to its queue.
If all tests pass, change the Status back to "Reviewed & tested by the community". We'll most likely commit the patch immediately without having to go through another round of peer review.
We apologize for the trouble, and appreciate your patience.
Comment #6
mpdonadioSame patch as #1, just reuploaded.
Comment #7
mpdonadio#6 is green, so per #5, setting back to RTBC (which was set in #4).
Comment #8
DamienMcKennaLooks good.
Comment #10
DamienMcKennaCommitted.
Comment #12
fairrandir CreditAttribution: fairrandir commentedJust to mention: module is named "comment", not "comments".