[wp-trac] [WordPress Trac] #48104: Add the gutenberg_provide_render_callback_with_block_object shim to core

WordPress Trac noreply at wordpress.org
Mon Dec 16 14:59:28 UTC 2019


#48104: Add the gutenberg_provide_render_callback_with_block_object shim to core
-------------------------------------------------+-------------------------
 Reporter:  andraganescu                         |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  5.4
Component:  Editor                               |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-testing needs-dev-   |     Focuses:
  note needs-docs                                |
-------------------------------------------------+-------------------------

Comment (by aduth):

 Part of making the navigation block dynamic was adding a new filter at
 pre_render_block which enhances the way blocks are passed to the server
 render callback by passing render_callback the block object as the
 argument.

 Can you elaborate on why these changes were needed? At a glance, the
 `$block` parameter seems highly redundant with the previous parameters
 (which are effectively `$block['attrs']` and a derivation of
 `$block['innerContent']` respectively). Just seems like we're adding more,
 without having a good sense of what we're expecting people to be using
 this function for. Or it's a scenario where, in retrospect, we should have
 just given the `$block` object as the sole parameter and left it to the
 block to deal with.

 I wonder if there's also another option for these blocks where, instead of
 adding this through the block interface `render` callback, a block can
 choose to implement their own advanced rendering by applying their own
 hooks to `render_block` filter, etc.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48104#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list