[wp-trac] [WordPress Trac] #51850: WP_Block: Inner blocks not being set
WordPress Trac
noreply at wordpress.org
Mon Nov 23 13:42:11 UTC 2020
#51850: WP_Block: Inner blocks not being set
--------------------------------------+-------------------------
Reporter: noisysocks | Owner: noisysocks
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 5.6
Component: Editor | Version: 5.6
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+-------------------------
Comment (by azaozz):
This looks like a "logical companion" to `WP_Block::__get()`. However in
the PHP manual there are some pretty strong, valid objections to using
these magic methods:
https://www.php.net/manual/en/language.oop5.overloading.php#allnotes.
Looks like in WP 5.5 `WP_Block::__get()` was used only to retrieve the
block attributes: https://core.trac.wordpress.org/browser/tags/5.5/src/wp-
includes/class-wp-block.php#L153, however in 5.6 it changed to get
everything.
I'm probably missing something but why is that public `__get()` needed?
The `$parsed_block` is passed in the constructor, so the
`get_attributes()`, `get_inner_blocks()`, `get_inner_content()`, etc.
would work without lazy-loading. What is the problem with setting the
properties in the constructor at the same time as `$parsed_block`?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51850#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list