The following Views field handlers do no check if a node's content type is webform enabled before rendering links:
- webform_handler_field_node_link_edit
- webform_handler_field_node_link_results
Sample Use Case
A site builder creates a view of content with various operations links. The links might include edit node, edit form, and form results. Nodes returned by the view are of various content types, which may include article, page, and webform. Only the webform content type is Webform enabled.
Results
Edit form links and form result links are printed for nodes of all content types, even those content types that are not Webform enabled.
Expected Results
Edit form links and form result links are printed only for content types that are Webform enabled.
Proposed Solution
Modify the render_link function in each handler to check if a node's content type is Webform enabled.
Comment | File | Size | Author |
---|---|---|---|
#6 | webform-webform_enabled_check-2501437-6.patch | 795 bytes | Chris Burge |
#3 | webform-webform_enabled_check-2501437-3.patch | 2.58 KB | DanChadwick |
#1 | 2501437-1-webform-views-handlers-check-webform-enabled.patch | 1.36 KB | Chris Burge |
Comments
Comment #1
Chris Burge CreditAttribution: Chris Burge commentedComment #2
DanChadwick CreditAttribution: DanChadwick commentedSeems like a reasonable enhancement to the intended use of these handlers, which is the content display of webforms.
Comment #3
DanChadwick CreditAttribution: DanChadwick commented#1 worked perfectly. Thank you. I tweaked it for style a bit and added a static cache for webform_node_types, which is called from various loops.
Committed to 7.x-4.x.
Comment #4
DanChadwick CreditAttribution: DanChadwick commentedComment #6
Chris Burge CreditAttribution: Chris Burge commentedThe committed patch from #3 caused a regression.
The access check in the 'render_link' function in the 'webform_handler_field_node_link_results' class was modified to check node edit permission instead of webform results permission:
Patch attached to address regression.
Comment #7
Chris Burge CreditAttribution: Chris Burge commentedComment #9
DanChadwick CreditAttribution: DanChadwick commentedThanks, Chris! Good catch. I didn't notice the access check was different.
#6 committed to 7.x-4.x.
Comment #10
DanChadwick CreditAttribution: DanChadwick commented#3 and #6 need port to D8.
Comment #11
fenstratCommitted and pushed #3 and #6 to 8.x-4.x. Thanks.
Comment #18
DanChadwick CreditAttribution: DanChadwick commentedYeaaah, testbot, you're living in the past, dude (or dudette). Already committed.