Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#50257 closed enhancement (fixed)

Editor: Remove default "layout" block attribute from WP_Block_Type::get_attributes

Reported by: aduth's profile aduth Owned by: gziolo's profile gziolo
Milestone: 5.5 Priority: normal
Severity: normal Version: 5.0
Component: Editor Keywords: has-patch
Focuses: rest-api Cc:



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

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 CSS Grid Layout.

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

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 GB#11029


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


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:

With the pending 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.

Attachments (1)

50257.diff (600 bytes) - added by aduth 4 years ago.

Download all attachments as: .zip

Change History (4)

4 years ago

#1 @aduth
4 years ago

  • Keywords has-patch added

#2 @TimothyBlynJacobs
4 years ago

  • Focuses rest-api added
  • Milestone changed from Awaiting Review to 5.5
  • Version set to 5.0

I don't see any issue with this from the REST API side of things.

#3 @gziolo
4 years ago

  • Owner set to gziolo
  • Resolution set to fixed
  • Status changed from new to closed

In 48118:

Editor: Remove default "layout" block attribute from WP_Block_Type::get_attributes

The merging behavior which assigns the layout attribute in WP_Block_Type gets removed.

Props aduth, TimothyBlynJacobs.
Fixes #50257.

Note: See TracTickets for help on using tickets.