[wp-trac] [WordPress Trac] #54647: Blocks: Add support for themes to block API v2 with assets in block.json

WordPress Trac noreply at wordpress.org
Fri Apr 1 11:28:49 UTC 2022


#54647: Blocks: Add support for themes to block API v2 with assets in block.json
-------------------------------------------+------------------------------
 Reporter:  whoisnegrello                  |       Owner:  (none)
     Type:  defect (bug)                   |      Status:  new
 Priority:  normal                         |   Milestone:  Awaiting Review
Component:  Editor                         |     Version:  5.5
 Severity:  normal                         |  Resolution:
 Keywords:  has-patch needs-testing close  |     Focuses:
-------------------------------------------+------------------------------

Comment (by fabiankaegy):

 Thanks @ocean90 for flagging that I created a duplicate ticket.

 I have also created a patch here: https://github.com/WordPress/wordpress-
 develop/pull/2494

 As far as the rationale for not including blocks in themes goes I agree
 with it from the best practices standpoint. Yes, themes should only worry
 about the visual representation, and plugins should worry about the
 functionality.

 However, there sometimes are cases where that distinction isn't that
 clear. Especially in purpose build custom themes it does arise, that
 blocks are created as layout tools that wouldn't work without the theme's
 styling because the block essentially is the foundational building block
 of the theme.

 A workaround for this can be found here for example:
 https://github.com/10up/wp-
 scaffold/blob/a2586e31dcea350faa6d28373e606c17a045d44d/themes/10up-
 theme/includes/blocks.php#L51 where filtering the `plugins_url` allows a
 hacky way to achieve the same result.

 I don't think it should be necessary to have such hacky workarounds in
 place. Yes, the best practice should always be to put them into plugins.
 But there are special use-cases where it also makes sense to allow it for
 custom-tailored themes.

 This was also discussed in the third installment of the Core Gutenberg
 Developer Hours between @gziolo and myself.

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


More information about the wp-trac mailing list