Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #51850, comment 4


Ignore:
Timestamp:
11/23/2020 01:49:13 PM (4 years ago)
Author:
azaozz
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #51850, comment 4

    initial v1  
    33Looks 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.
    44
    5 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`?
     5I'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 additional loading, lazy or not. What is the problem with setting the properties in the constructor at the same time as `$parsed_block`? (Looks like they will have to be set in the new `WP_Block::reset()`.)