I wrote a custom block and am trying to better understand the interplay of the JavaScript and PHP on both front and back end regarding blocks.
Say I have some block that I want rendered dynamically. That leads to questions:
- For dynamic blocks I take it we have to guarantee that the attributes are in the JSON in the comments delimiter?
- On front end, is there any reason to have the block comments displayed? Should we always use a filter when displaying posts to remove the block comments, or are these attributes someone used by client side javascript?
- Endpoints: Here is where I am really confused. For dynamic block rendering we are supposed to specify a PHP callback. Is that to be called by a restAPI endpoint (in which case do we have to set show_in_rest to true for dynamic blocks?) or is there a separate mechanism?
Just looking for some clarification on these points.
thanks