wp-comments
package to your project:packages
array in frontity.settings.js
.frontity.settings.js
@comments/:id
handler to fetch all the comments of a specific post (actions.source.fetch("@comments/60")
).state.source.get("@comments/60")
to get the ID's of these comments.state.comments.forms[postId]
to store the data of the comment and the submission status.state.comments.forms[postId]
can be updated through the action actions.comments.updateFields()
.actions.comments.submit()
which will send the data available at state.comments.forms[postId].fields
.state.comments.forms[postId]
and if there are errors they will be available at the properties errorMessage
, errorCode
and errorStatusCode
.@comments/:id
wp-source
handler gets all comments published in the specified post (using its ID) and creates a tree structure with comments and their replies in the data object.frontity.state.source.data["@comments/60/"]
) with a tree structure of comments and replies, sorted by date (most recent first).state.comments.forms[postId]
wp-comments
package stores a map of objects by post ID in state.comments.forms
. Each of these objects represents one comment form. These objects are intended to be used as the state of React <form>
components and contain the input values as well as the submission status. They have the following properties:isSubmitting
isSubmitted
isError
errorMessage
errorCode
rest_comment_invalid_post_id
errorStatusCode
state.comments.forms[postId].fields
updateFields()
action described later.content
authorName
author
authorEmail
authorURL
parent
state.source.comment[id]
comments.submit()
action.state.source.comment[id]
.actions.comments.updateFields()
postId
. This action simply updates what is stored in state.comments.forms[postId].fields
with the given values.postId
comment
state.comments.forms[postId].fields
βactions.comments.submit()
postId
. It submits the fields stored in the respective form (i.e. state.comments.forms[postId]
) or the fields passed as a second argument. If fields are passed, those replace the current values stored in state.comments.forms[postId].fields
.state.comments.forms[postId].isSubmitted
property (described above) to determine the submission status.postId
comment
state.comments.forms[postId].fields
β@frontity/wp-comments
package.