Problem/Motivation
AJAX comments are configured in a view mode's comment field. Currently, however, this works only in the 'full' view mode. Configuring any other view mode to support AJAX comments leads to the bug that the form submits but no update is returned.
This bug is deeply embedded in the code base. There are six places where the 'full' node view mode is hard-coded.
Proposed resolution
Currently the implementation is attached to field configuration in node view modes, which introduces problems because it is in various comment contexts that we need to determine whether/how the behaviour should apply.
An alternative that might address this issue (albeit with significant refactoring) is to make AJAX comments instead a property of comment view modes.
- An admin configuring a comment view mode has a checkbox to make the view mode use AJAX comments.
- To apply AJAX comments to a given content type per view mode, configure the node's comments to use a view mode for which AJAX comments are enabled.
- Via config/install, provide an 'ajax' comment view mode and enable AJAX comments on it.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#3 | ajax_comment-2826567.patch | 2.33 KB | ziomizar |
Comments
Comment #2
Rop CreditAttribution: Rop as a volunteer commentedIf you enable the field in the 'Default' viewmode it works.
Comment #3
ziomizar CreditAttribution: ziomizar at East Atlantic Engineering commentedAttached patch solve the problem for me.
I did a check on the parameter before passing it to Drupal\ajax_comments\FieldSettingsHelper::isEnabled()
Comment #4
vierlexI would be very interested in a solution which lets you configure the commented entities display mode, which is hardcoded as 'full' (in in the function itself defaults to 'default') as already mentioned..
I cant seem to figure out a way to get the currently rendered view_mode of the parent entity at those 4 points in the code the current patch is editing to get rid of an error.
Comment #5
proweb.ua CreditAttribution: proweb.ua commentedin Drupal 8.4.3 + ajax_comments 8.x-1.0-beta1
when the comment field isn't in the "full" view mode, i see error
patch #3 does not fix the bug
Comment #6
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedSame as number 5
Comment #7
nedjoCurrently the implementation is attached to field configuration in node view modes, which introduces problems because it is in various comment contexts that we need to determine whether/how the behaviour should apply. An alternative that might address this issue (albeit with significant refactoring) is to make AJAX comments instead a property of comment view modes.
Updating the issue summary accordingly.
Comment #8
RumyanaRuseva CreditAttribution: RumyanaRuseva at FFW commentedComment #9
darvanenThe hard-coding of view_mode definitely needs to go, and I don't see an easy way to do that without a new architecture because comments can be viewed on their own without the commented entity being called (and therefore no way to specific a view mode).
I agree with @nedjo.
Comment #10
dqd1+ !
Comment #11
qzmenkoAt the moment, an attempt is being made to solve the problem in another issue #2896916: Ajax not working when using non-default view mode.