[wp-trac] [WordPress Trac] #50257: Editor: Remove default "layout" block attribute from WP_Block_Type::get_attributes

WordPress Trac noreply at wordpress.org
Tue May 26 19:09:55 UTC 2020


#50257: Editor: Remove default "layout" block attribute from
WP_Block_Type::get_attributes
-------------------------+-----------------------------
 Reporter:  aduth        |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Editor       |    Version:
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 **Background:**

 The implementation of `WP_Block_Type::get_attributes` will merge a default
 `layout` attribute to the registered attributes of a block type:

 https://github.com/WordPress/wordpress-develop/blob/adcf5cf7/src/wp-
 includes/class-wp-block-type.php#L193-L215

 The `layout` attribute was relevant for a short time in earlier iterations
 of the block editor, specifically in initial implementations of Columns
 block for Gutenberg, where individual Column blocks would use the `layout`
 attribute to assign their position within columns styled using
 [https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout CSS Grid
 Layout].

 https://github.com/WordPress/gutenberg/pull/3745

 It was later effectively deprecated in favor of an implementation which
 used individual wrapper elements for each column.

 https://github.com/WordPress/gutenberg/pull/7234
 https://github.com/WordPress/gutenberg/pull/11029

 The fact that a reference had continued to exist in
 `WP_Block_Type::get_attributes` is likely to have been an oversight. It
 did exist at the time of (and after) the changes of
 [https://github.com/WordPress/gutenberg/pull/11029 GB#11029]

 https://github.com/WordPress/gutenberg/blob/45cb5178/lib/class-wp-block-
 type.php

 **Proposal:**

 The merging behavior which assigns the `layout` attribute should be
 removed.

 **Impact:**

 It's unclear (but unlikely) that this attribute will have provided any
 usefulness for block implementations, since there is no attached
 functionality aside from the block type attribute schema definition.

 At the current point in time, there is only a single reference to
 `WP_Block_Type::get_attributes` in the current core codebase: in the block
 server render endpoint, which would not be impacted by its removal:

 https://github.com/WordPress/wordpress-develop/blob/8efc532/src/wp-
 includes/rest-api/endpoints/class-wp-rest-block-renderer-
 controller.php#L65

 With the pending [https://github.com/WordPress/gutenberg/pull/21065
 introduction of a block types endpoint] (#47620), it's more likely that if
 the behavior isn't changed, it could become a source of confusion for
 consumers of this endpoint.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/50257>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list